Delog 1: Movement


THE THING, IT  MOVES

The player movement scripts are hooked up and running, meaning that now we can dodge duck dip dive and... dodge. Wait, no, actually we have a little placeholder professor with 8 way movement, dashing, and direction locking. Let’s grab some tea and chat about what that all entails.

8 Way Movement

The professor (entirely unrelated to the game, and doomed to be replaced soon) can move in the 4 cardinal directions and on diagonals. This is implemented through a simple script takes the input of the player (any combination of up, down, left, and right), and converts those inputs into a new 2D velocity every frame. The player’s velocity is updated to match this vector each frame, resulting in a smooth movement.

 The professor’s sprite sheet only has sprites for the 4 cardinal directions, and I’m on the fence about whether to ultimately lock movement into those directions. This has nothing to do with the particular sprite sheet and everything to do with the simplicity of the core game mechanic – hugging zombies should involve a clear animation that doesn’t have too many sprite variants, which will bloat my development time considerably. If I limit movement to 4 directions, the number of zombie hugging sprites I need to create will drop meaningfully.

Dashing

The player dash was achieved with a script that triples their base speed for a very short time (currently 0.2 seconds) when the player presses the space bar. Dashing can’t be restarted during the dash, meaning that the player must wait for a dash to finish before performing another one. I have two options from here: I could enforce a short cool down after finishing a dash, or allow another dash to be inputted from the moment the previous dash has finished. This will ultimately come down to play testing when enemies are implemented. If the game is too easy, enforcing a cool down on the dash could be a good way to increase difficulty.

Direction locking

A key enemy in the game is an elderly zombie who will lock the player in conversation. Listening to the zombie for a certain period will calm and put it to rest. When the player is being talked at, they can move as far from the zombie as they like but they *must* remain facing them. If the player stops facing the zombie, the enemy will emit a very difficult to dodge attack and the timer for calming them will temporarily lock, preventing you from putting them to rest, and forcing you to endure their attacks for longer.

The implementation of this feature is very simple: when the player presses left shift their current facing direction is ‘locked in’, and they will continue to face the current direction during any movements, until they release the button. This is achieved by storing the inputs at the moment of locking and sending those saved inputs to the animation system, which takes inputs and figures out how to animate the player sprite. As long as the player holds shift, the animation system will keep receiving those old inputs instead of the actual inputs, meaning that even as the player moves about however they like, the animation system will ensure that their sprite remains facing the original direction.

Player Feedback

I wasn’t able to get feedback on my movement system this week. Hopefully that will change soon!

References

Professor sprite sheet: https://opengameart.org/content/feralfantoms-entry

Get Zombie Hugger

Leave a comment

Log in with itch.io to leave a comment.