Player Movement


Player Movement Devlog

This is the first devlog for my game Ultimate Pacman and it is about player movement.

For the player they will be Pacman. The Pacman sprite was obtained and also made to animate using a spritesheet found here: (Game Development, 2020).

This animation is shown in the GIF below:

 

To animate the player I first converted the spritesheet into multiple sprites by slicing it. I then made the Pacman player animate using the animation window where I set the sprite to change to the next at regular intervals. I made the player face the direction they were travelling in as well. This was done in a player movement script (a modification of one from a practical) using the transform component and setting the rotation so the player was facing where they were travelling each time a key was pressed (in the same position in the script as where the velocity is set). An alternative approach that was considered was using a blendtree and changing the animation based on the direction of travel.

For this checkpoint I made my Pacman player move around the screen. The player is only allowed to move either up, down, left, or right. I implemented this player movement by adding a rigidbody2D to the player with gravity set to zero and by implementing the player movement script. This script contains an option for the player’s movement speed which is customisable in the inspector. The player was able to move in the direction of the corresponding key (wasd of the arrow keys) when it was pressed by setting the velocity of the rigidbody2D to the movement speed selected in the inspector using a transform component. The player was only allowed to move in each of the specified directions because they will be moving in a grid with no corners just straights and right angles where a turn is made. An alternative approach that was considered was to set the velocity using vectors rather than transform components.

This player movement is shown in the GIF below:

 

The feedback received from various members of the tutorial group consisted of statements saying that the player moved like Pacman should and that the animation looked as it should. The comments overall showed that the people giving the feedback were pleased with how the player moved and how they looked when they moved. Some planned ideas for improvement are to add customisations to the colour of the player and the speed at which he moves in the game, so it looks the way the player wants it too and the difficulty is where they want as well.

 

References

Code Avengers. 2020. Game Development. [online] Available at: https://www.codeavengers.com/teacher/game#6.2 [Accessed 27 August 2020].

Leave a comment

Log in with itch.io to leave a comment.