DevLog_01 Player Movement


Player Movement

This week I implemented player movement, as well as created a testing level to trial different situations the player might find themselves in. From early on I decided that the character needs to be able to move left and right, with a slight slide when stopping movement so as not to feel too rigid. I also wanted the player to be able to jump at different heights depending on how long the player holds the jump button. I also wanted keyboard controls to be able to be used with a single hand to increase accessibility for players. 

 I wanted the player jumping to feel predictable, repeatable, and responsive. To do this I used a physics-based approach so that when the player hits the jump button there is a quick push upwards on the character. I also added a bit of coyote time to jumping so that if player hits jump a few milliseconds too late after falling off a ledge, Ampi will still jump. Things were feeling too floaty, so I pumped the gravity modifier up to 5 on Ampi and called it a day.

 I wanted the player to slide a little when stopping movement or changing directions, so I needed a more physics-based approach. After trying a few different options, I settled on adding a small amount of slide to player movement after watching through a few online tutorials. I also added a sprint function to give the player more control over movement speed and jump distance.


Testing player movement.

Animation/Art

In real life capsules don’t have legs (usually). The game didn’t look interesting with only a capsule magically sliding around, so it needed some quick animation. I added the sprite and gave it some bones for animation. I also set up animations so Ampi can open her mouth to attack.


Screenshot of character with colliders and detectors

Testing Environment

The testing environment needed to have obstacles that would be in the final game, but also test for physics problems that might occur. One I suspected that would happen was that when hitting an angle mid-jump, Ampi would get an extra boost. I also wanted to add platforms that you can jump through, then land on top of. This led to a glitch, see player feedback below! 

Player Feedback

“Slide feels good as well as movement in the air, just one thing I think is a little weird is that you can start sprinting when you are in the air. Also, you can sometimes "boost" through the platforms when jumping through a platform from below and holding space, I don't know if this is intended or not – Benji.”

  
Left: Jumping through platform glitch.     Right: Normal jumping height

I hadn’t considered hitting shift mid jump and increasing movement speed in an unnatural way. This was a simple fix by adjusting one line of code, let’s not get bogged down with the details. 

The platforms shouldn’t allow a player to have some sort of boost (although that could be a cool glitch-based feature for a future game). It looked like the problem was coming from the player detecting they are on the ground as they pass through the platform; so, if holding the jump button when flying through the platform then the player is technically jumping again and again as they pass through. I fixed this by making sure there was nothing to really pass through: I switched out a box collider for an edge collider. 

“ditto what benji said, the movement is great. not sure how i feel about ctrl being the attack button, it feels slightly uncomfortable. and when i hold ctrl + D / S, my browser wants to save the page (or is that just me?? haha)” – Georgie

In hindsight, having control as an attack button isn’t great for a browser-based game. Being able to play the game with only one hand is really important, so the simplest solution was to change attack to the space bar and move jump to the W and up arrow keys. I had considered picking another key but that would require the player to either take their fingers away from WASD, or have their thumb try to reach for a key in the middle of the keyboard, leading to accidentally hitting the wrong key. This fix helped with the reachability of all controls (WASD, shift, space).

 That’s it for this week! 

Files

Ampi.zip Play in browser
Sep 10, 2023

Leave a comment

Log in with itch.io to leave a comment.