Player Movement


Overview

*note: at original time of posting the uploaded build was unplayable due to issues with making a WebGL build. Feedback was acquired from friends, family, and peers who played the game directly in Unity.

 This dev log is a general overview of some of the initial character movement developments. For this milestone I attempted to implement basic character movement (left, right, jump, fall), some more complex movement features (coyote time, variable jump height, strafing), the fishing rod (line cast, grapple), and character attacks (basic attack, combo attack). All animations and sprites are original and were created in Aseprite.


Walking

  • Walking is relatively slow, as to the fisherman’s older, slower vibe.
    • This was achieved by setting the players RigidBody2D velocity with a Vector2D in the update method of my PlayerMovement script.

WalkingThe Last Fishing Trip - Character Walking Left + Right


  • Strafing holding the shift button (the direction of the character is locked to face one way). 
    • In the FlipCharacter function in my PlayerMovement script if the left-shift button is held down the method returns null. In result, the player does not flip and continues facing the same direction they were facing when the button was initially pressed despite input in the opposite direction.

StrafingThe Last Fishing Trip - Character Strafing


Jumping

  • To ensure the player is on the ground, a ground check is performed with Physics2D.OverlapCircle() to check collision with the ground layer. If isGrounded = true, the player can jump (when in air isGrounded = false)
  • Variable jump height: while the jump button is pressed the player jumps higher (tapping jump button results in small jump).
    • This was achieved by multiplying the y velocity by 0.5 when the jump button is lifted (GetButtonUp()). In addition adjusting the gravity scale of the rigid body 2D at different parts of the jump allows for more control over how floaty the jump feels. This can now be adjusted in the inspector component in Unity.

Jumping The Last Fishing Trip - Character Jump

  • Coyote Time: a period of time in which the player can still jump despite not touching the ground.
    • This was achieved by setting a coyote time timer that begins to count down when the player runs of an edge. If the timer has not reached 0, the player can still jump.

Coyote TimeThe Last Fishing Trip - Coyote Time

Fishing Rod

To manage the fishing rod functions I created a state machine that switches between the following states: Idle, Shooting, Hooked, Returning.

  • Idle: if the player is idle the line render component is disabled and an if statement checks if the Fire2 button has been pressed
  • Shooting: This happens as a result of the ShootHook function being called. This function sends a Raycast within the hook distance and checks if a hookable layer is hit.
  • Hooked: If a hookable layer is hit the line renderer sticks to the layer and pulls the player toward the hooked wall.
  • Returning: If nothing is hit by the shooting Raycast, the line renderer shoots out and retracts .

Rod GrappleThe Last Fishing Trip - Rod Grapple


Attacks

  • The attack button (Fire1) can be pressed to do an attack with the fishing rod.
    • Attack rate variable determines how often the player can attack, higher numbers are slower (can be adjusted in inspector).
  • If an enemy is within the attack point, they are dealt damage (damage adjustable via the inspector and dependent on the point in combo).  
    • In code, this is achieved though the creation of a Collider2D array that gets filled with Physics2D.OverlapCircleAll(). For each hit in the array damage is dealt to enemies. 
  • Three hit combo: if the attack button is pressed within a window of 0.2 seconds the player can perform attack2, and attack 3 (if pressed again).
    • There is a 1 second cooldown between combo attacks and each consecutive attack in a combo deals more damage.

Combo AttackThe Last Fishing Trip - Combo Attack


User Feedback:

 

Feedback from peers and friends indicated excitement for future developments along with some ideas for improvement. In general, testers enjoyed the juxtaposition between the intentional slowed movement of the old man and the speed of grappling with the fishing rod. Players had fun with the grapple! It was noted that the grapple led to some funny bugs, sometimes resulting in the player grappling through a wall). However, I am already aware of these bugs and they will be fixed in future updates. 

Rod Collision GlitchThe Last Fishing Trip - Rod Collision Glitch

The player movement and falling speed all were reported to feel appropriate. Much of the feedback discussion was around to implementation of the fishing rod grapple. One person stated that “they love the item-based movement” and another offered a suggestion “depending on the objective of the game it might be cool to add a 0.5 second delay between the grapple and the pull”. Given my goal for effortless movement with the fishing rod, I believe that a delay may detract from the fluidity and ‘snap’ of the current grapple. However, I can see how that could work with a slower paced movement system.

 The more I go into adding features, the more complex the debugging and polishing process is becoming. There are several movement elements that I am yet to add however, such as wall jumping and maybe a slide of some description. These could be added through the game as the player progresses.

 


Future Fixes/Updates

In the next week I would like to make a few adjustments to the current player movement:

  • The player receives an additional jump after hooking a hookable wall/object to enable some interesting platforming challenges
  • Wall jumping, with follow up interactions for the fishing rod (e.g., hooking into a wall jump into hooking, into jump, into wall jump, into hooking, into jump etc.)
  • Fix the fishing rod cast while in mid-air. Currently, the line renderer shoots from the tip of the rod in the direction the player is facing when the button is pressed. However, when the player falls, the end of the rod moves down but the end of the line remains travelling towards the point defined when the fire button was pressed. This creates some weird effects where the line looks warped or diagonal. I would prefer if the line shot out and the hook point moved downward with the player.

Line Casting Diagonally The Last Fishing Trip - Line Casting Diagonally

  • While in mid-air the casting animation does not play until back on the ground (also various fixes required, e.g., if the player is allowed to jump while casting).
  • Continue momentum when casting through a grapple point in mid-air. (so the player flings forward rather than stopping in mid-air and falling.


Cheers!! 

Kronkerd (Taylor) 

Files

MovementBuild.zip Play in browser
84 days ago

Leave a comment

Log in with itch.io to leave a comment.