Player Movement


Implementation

At this point basic player movement is implemented, which includes moving in any direction across the screen using WASD. Player movement is physics based which means movement is done by applying a force to the player's rigidbody in the direction to move. Another approach would have been to use a non-physics based system where the player could quickly switch direction. The physics based system was chosen as this would make it harder to dodge projectiles/obstacles as well as make it easier to hit enemies. The player will continue to move in one direction unless they are manually stopped (shown below).


The player also has the option of toggling autostabilisation which slows down the player when they aren't pressing any movement keys (shown below). Auto-stabilisation works by apply a force opposite the player's current velocity. However, once the player reaches below a certain speed threshold, the velocity is set to 0 in order to stop micro-movements. 


The player is confined to the camera space, hitting a ‘slowdown’ zone when near the edge of the screen and hitting a hard border right at the edge of the screen. Another approach would have been to have no slowdown area and just have the hard border. The slowdown area was implemented in order to have a more natural looking stop when near the edge of the screen instead of stopping suddenly, as well as providing a ‘soft’ border.  The ‘slowdown’  zone is implemented by applying a drag force but only in one direction. This means that the player’s movement will only be slowed down when moving towards the border. For example, when near the left border only movement to the left is slowed down (shown below).


Feedback and Potential Improvements

One piece of feedback was having autostabilise be enabled when holding a key instead of it being a toggle. This will be added as option. Another piece of feedback said that the ‘slowdown’ zone was a bit fast, I may reduce the drag for it or redo the implementation slightly. Another piece of feedback mentioned having thruster effects for movement including autostabilisation. This will be implemented further down the line. Overall people were happy with how movement felt, however movement may be altered slightly in the future for game balance or from player upgrades.

Files

Build.zip Play in browser
Apr 19, 2023

Leave a comment

Log in with itch.io to leave a comment.