Movement


Player Movement

 

Left/Right Movement:

To make my character move left and right in the game I used some code from my pong game that transformed an object using an increment variable along the Y-axis making the paddle move up and down when the W or S keys were pushed. After changing the code so it worked along the X-axis moving the character back and forth using the A or D keys. I then multiplied the movement speed increment variable by the Time.deltaTime function so the movement was smoother once this was done I was very happy with how the player character movement felt and moved onto the Jumping aspect of the game.

 

Jump:

Originally, I implemented the jump method the same way but found it made the initial upwards motion of the jump to jittery with the player character basically teleporting to the top of the jump height. After trying a couple things, I decided to use the addForce function using the impulse force which smoothed out the jump and made it more streamline. I then used the overLappingCircle function to check if the player was grounded so they couldn’t just jump forever.

 

Feedback:

Player gets massive jump boost if he hits the side of a platform.

That was the biggest issue about my movement and I am currently looking into using a downwards facing raycast to check if the player was grounded instead but this bug also made me think of a possible fun implementation of a small boost with the player hits the side of a platform to simulate the player pulling himself up that platform. 


Leave a comment

Log in with itch.io to leave a comment.