WebCraft icon indicating copy to clipboard operation
WebCraft copied to clipboard

Fly command

Open SmilerRyan opened this issue 6 years ago • 3 comments

Currently to reach places high up, you must build, jump and delete blocks after to get to a location. How would I add a /fly command, which simply disables falling when users press (or hold) a key (ex. f)?

SmilerRyan avatar Sep 11 '18 12:09 SmilerRyan

Like this: a5e1d17e024baddb68b90e2843529312c28cca40 Btw, the movement code in ./js/player.js is very nice to play around with and modify. You could easily e.g. add a sprint option by finding out how to detect a "shift" press in javascript and then increase the speed here accordingly.

Here are the steps I took to actually run the project (a bit hidden imo):

$git clone this-repo
$npm install socket.io express
$node server

Then visit http://localhost:3000/multiplayer.html or http://localhost:3000/singleplayer.html in a browser (or replace localhost by your ip-adress)

cymno avatar Sep 15 '18 03:09 cymno

Thanks, however this has only partially solved my solution as I cannot move any other direction except for up/down while holding the key to fly.

SmilerRyan avatar Sep 16 '18 02:09 SmilerRyan

Yes, for that it is necessary to enable in-air movement. This also makes the jump more responsive, as it is possible to adjust the direction after the jump has already started. If you'd really like to keep the old system it's also possible to enable in-air movement only when "f" is pressed.

cymno avatar Sep 16 '18 17:09 cymno