DevLog 1: Player Movement


Player Movement

This is the first devlog for my game, Agent X regarding the player movement.

Animation

Figure 1: Left-right Movement

The GIF above demonstrates how the player would move left and right.

Figure 2: Player Jump


The GIF above shows the player jump animation.

Figure 3: Idle Animation

The GIF above illustrates the player in an idle state animation, in which the player bobs about.

Figure 4: Player Spritesheet

The above spritesheet consists of an East movement, West idle, West Movement, and East idle.

The animation of the player was achieved by taking the spritesheet and converting the sprite mode into “multiple”. After that, an Idle blend tree – consisting of West Idle and East Idle animations, and a Running blend tree – consisting of a West Run and East Run were created. A script called PlayerMovement2 – a simplified version of the PlayerMovement script provided in the tutorials was used to match the direction the player faced in the direction they were travelling. This was done by setting the XSpeed to either -1 (left) or 1 (right) according to when the represented control key was pressed.

 

Implementation

The controls are the A key to move left, the D key to move right, and the spacebar to jump, whereby the player is limited to a movement direction of left and right. The movement of the player was implemented by adding a Rigidbody 2D, Polygon Collider 2D, and Animator component to the player game object.

The gravity of the player’s Rigidbody2D was set to 6 to ensure that the player does not have a floating effect when jumping. The PlayerMovement2 script contains a jump strength or how high the player can jump and the speed of the player that is customisable in the inspector window. The left-right movement of the player was applied by using the horizontal axes function from the input manager that sets the XSpeed according to the key pressed. Alternatively, the left-right movement could have been accomplished by relying on a script to adjust the transform component and setting the rotation to enable the player to face the direction of travel according to the key pressed.

The jump ability of the player was executed by creating a Boolean variable called “isGrounded” that checks if the player is on the platform, allows the player to jump again only when they collide with the platform.

 

Feedback

Movement feels tight and responsive, spike collider might be too big.
If I land on an enemies' head, the player seems to shoot up into the sky.
When you jump on the enemies' head you get a massive jump boost, and the enemies seem to double jump, sometimes even triple jump.
Movement and jumping is clean and has no real issues. Fun to jump across rooftops, kind of a nice Spider-Man vibe. The health system works well with the heart pickup. Apart from what others have said, nothing else to add for now.

In summary, the feedback provided indicated that the player movement was smooth and worked well. As such, I have begun to address some of the other issues that people have pointed out. To fix the spike collider being too big, the size of the BoxCollider2D on the spike had to be reduced. Besides that, I made the player die when they jump on the enemies’ heads and get launched into the sky. Finally, to fix the multiple jump issue for the enemy, the “isGrounded” Boolean to enable the enemy to jump again only when they are on the ground needed to be debugged and fixed. 

Improvements to look into would be to making the enemy movement smoother and less jerky. Additionally, some additional obstacles besides spikes on the ground are to be considered such as wrecking balls and such.

 

References

OpenGameArt.org, 2013, City Background Repetitive, viewed 15 August 2021, <https://opengameart.org/content/city-background-repetitive>.

OpenGameArt.org, 2015, Background Night, viewed 25 August 2021 <https://opengameart.org/content/background-night>.

OpenGameArt.org, 2019, RPG Character 'Agent' NES, viewed 9 September 2021, <https://opengameart.org/content/rpg-character-agent-nes>.

 

Files

Build.zip Play in browser
Sep 08, 2021

Leave a comment

Log in with itch.io to leave a comment.