Devlog - Player Movement
Soup Weather is a side scroller game and so the player is limited to moving left or right with the ability to run and jump.
Player movement is controlled using A & D to walk left or right, SHIFT to run, and SPACE to jump. The movement is handled by one script and is linked to an animator, and to another child object called "Ground Check".

Basic movement
Using input of A and D keys we set the value of x using a direction variable and speed variable, then use this value to set the velocity of the player rigidbody. We can determine the direction of the player by if the direction variable == < or > than 0 and transform the image to flip to left/right facing (+ or - transform scale).
Running and Jumping
Using the input of SHIFT we multiply the value of Xvelocity to increase the speed of the player and trigger the animator to play the Bean Run animation (X == 4 plays "Walk", X == 8 plays "Run".
Using the input of SPACE applies upwards velocity determined in the inspector ("Jump Power") to the player rigidbody and determines the value of Y Velocity. Y Velocity is used in the animator to determine if the player is moving upwards or downwards (Y == < or > 0) during the jump and plays the associated animation (Jumping or Falling).
A child object of the player called "Ground Check" is positioned at the feet of the player. If the "Ground Check" object collides with another collider on the "Ground" layer then the boolean "IsGrounded" is set to true.
When the "Ground Check" is not colliding with a "Ground" layer (aka the player is floating) then the boolean "Jump' is set to true. TotalJumps is set in the inspector to determine how many times the player will be able to jump whilst not grounded.
AvailableJumps decreases by 1 each time the player jumps. If AvailableJumps = 0 player will not jump, and "Jump" bool will = false.
When "IsGrounded" = true, the number of jumps permitted is reset (AvailableJumps = TotalJumps).
Files
Soup Weather
More posts
- Devlog - Testing5 days ago
- Documentation and User Guide6 days ago
- Devlog - UI & Polishing12 days ago
- Devlog - GRAPHICS BABY!19 days ago
- Devlog - Mini Games and Dialogue26 days ago
- Devlog - Basic Level Blocking33 days ago
- Soup Weather - Concept Development55 days ago
Comments
Log in with itch.io to leave a comment.