Player Movement (Week 8 Devlog)


Player Movement

General Overview

The player moves with the WASD keys in up to eight directions on the screen. The player is always facing the direction of the mouse as this is the direction attacks are cast. The movement speed of the player can be increased with upgrades which will be implemented in a later stage of the development process.

A possible improvement for future versions of the game could be the implementation of joystick movement; This would allow preciser controls due to free movement in 360 degrees.

Player Feedback

Previously, I had animations for west/east walking forwards/backwards but idle animations for north/east/south/west direction (Figure 1). As several people mentioned this was a little confusing and felt more like a bug than a feature; Therefore, I decided to drop the north/south idle animations and only use two-directional animations for all animated characters (Figure 2).

Figure 1: Old Player Movement with 4 idle states


Figure 2: New player movement with 2 idle states

Another point of criticism was the small enemy hitbox. Previously, enemies could only be hit at their feet, as the collider shared the functionality of movement collision and hit collision (Figure 3); However, this made enemies frustratingly hard to hit and gameplay overall unintuitive. Therefore, I added another BoxCollider2D (trigger) to detect hits on the whole enemy's body (Figure 4). I had to exclude the PlayerProjectiles layer from the movement collider at the feet in order to avoid two collision detections (and apply the damage twice) when shooting projectiles through both colliders. The goblin enemy prefab with the CapsuleCollider2D for movement collision and BoxCollider2D for hit collision can be seen in Figure 5.

Figure 3: Old projectile collision


Figure 4: Improved projectile collision


Figure 5: Goblin enemy with CapsuleCollider2D and BoxCollider2D

Additional Bugfixes

Another Bug I came across during testing the player movement is that damage numbers were instantiated directly above each other and couldn't be seen when an enemy was hit by multiple projectiles in the same frame. To prevent this from happening I added some random distance (Random.insideUnitCircle * 0.2f) to the transform position of the instantiated damage number; The result can be seen in Figure 6. This is probably not a perfect solution but it works well for now.

Figure 6: Multiple damage numbers on hit

Get Forsaken Colony: Last Survivors

Leave a comment

Log in with itch.io to leave a comment.