Devlog 1 - Player Movement


This week's focus was developing player movement for Floptimus Prime, ideally in a way which wouldn't complicate creating an alternate Phelony playthrough later on. My goals were basic left and right movement, jumping, and barking/attacking. I also decided to impliment idle and walking animations for Floptimus as I went.

Developing the walking and accompanying animations were straightforward; I created the sprite sheets in Pyxel Edit, sliced them within Unity, and created animations from those. Within one animation controller, I created states for 'Idle' animations and 'Walk' animations, as well as float parameters for 'YSpeed' and 'XSpeed' and one bool parameter for 'Walking'. Both states had '2D Freeform Directional' blendtrees that allowed me to assign the animations to the character's ingame horizontal movement. I'm considering implimenting animations for jumping, or simply moving upwards or falling downwards, though I would need to consider time restrictions and how this would be created within code. The 'Walking' parameter determines which state the controller should use, so Floptimus doesn't play 'Idle' animations while walking or the opposite.

Coding in a 'jumping' mechanic was more difficult, so I ended up researching different methods for coding 'jumps' for Floptimus. My first, which simply applied force underneath Floptimus when 'W' was pressed did work, but it allowed the player to have infinite jumps in mid-air. I considered a 'cooldown' method which would force the player to wait between jumps, but further research encouraged me to instead define the ground and make the player only able to jump when colliding with it. I attempted to use tags on surfaces that Floptimus' jumping code would check for, but switched to putting all platforms onto a specific layer when the tag-based code wasn't working as expected.

Finally, the barking attack involved the creation of a 'bark attack' prefab with its own animation and physics components that could be referenced later on when I needed to code in health and damage mechanics. The barks spawned beneath Floptimus and stacked upwards. They could be pushed and manipulated, but they quickly disappeared. I didn't think to apply any limitations on barks, as they disappeared quickly and were intended to reward player creativity and manipulation instead of key spamming. 

My overall testing made it apparent that, while my implimentations did technically work, they could all use polishing. The jumps were visually choppy and more testing with 'jump height' and in-game gravity would help create more appropriate realism and speed. The 'bark attack' was also very easy to abuse for quick movement and, while I considered code-based restrictions, I'm interested instead in deeply considered this factor during level design. Specifically, I believe the game would benefit from more restricted in-game areas.