Player Movement Devlog


The player of this game is a human. When the player is walking, he can go forward, backward and jump by pressing W/S and the space key. When the player is on the motorcycle, he can control the bike to move forward, backward and roll the motorbike by pressing W/S and A/D. 

For the player walking animation, I use a sprite sheet from a game called "Scott Pilgrim vs. the World: The Game". First of all, I sliced the sprite sheet into multiply sprites in order to create different animations. There are two animations that need to be created in this step. The first animation is left running animation and the second one is right running animation. Animations are controlled by a 1D blend tree in an animator controller.

The following gif is one of the player movement animations: 


For the player walking movement,  I add a rigidbody2D and a collider2D  to the player.  When we would like the player to move, we change the velocity of the player's rigidbody2D. When we would like the player to have a jump, we add a force to the rigidbody2D.  I also set a restriction for player jumping movement: the player can only jump when it is on the ground.  This is done by an on collision enter 2D in the player movement script.

The following gif shows the player walking movement:


For the motorcycle movement, I used a motorbike sprite from Internet and draw a wheel sprite by myself. Circle collider 2D and wheel joint 2D components are added to both wheels of the motorbike. Rigidbody 2D and polygon collider 2D are added to the body of the motorbike. I also create a car controller script to control the motorbike.  When players press key A or D, it will change the value of acceleration,  and the value of the motor speed of the back wheel.  The motorbike can start moving by changing the value of motor speed,

The following gif shows the motorbike movement:


I got following feedback from my classmates and my tutor:

1. The player movement spite needs to be slice more carefully to avoid black shadows. (9/12/2021 update: Now it is fixed.)

2. The player object can be smaller to match the background and other objects. (9/14/2021 update: Now it is fixed.)

3.  Player should fall faster when it is in the sky (9/14/2021 update: Now it is fixed.)


Source of the player movement sprite:

https://www.spriters-resource.com/fullview/70725/

Leave a comment

Log in with itch.io to leave a comment.