Movement and Enemy Spawns


Player Movement

The Last Guards movement is eight directional and top down, which is determined by the players input using the W,A,S,D keys. Animations are linked to each direction using the unity animator and the downloaded sprite sheet.  Figure 1.

Figure 1. Sprite sheet for archer animation

A big part of the difficulty of the Last Guard is the player's inability to move when attacking, this makes the player have to think of the best opportunity to shoot the zombies

Implementation

The movement is controlled within a unity script which reads the players input and sets the velocity of the player, this script also interacts with the animator sending through an XSpeed and YSpeed which determines the direction of the animation of the archer. 

Figure 2.

Figure 2. - Player and Zombie movement

Zombie Movement

The zombies in the Last Guard have a simple mindless seeker movement as they are just chasing a sent as most zombies do in games and movies. The script that is telling the zombies where to move finds the location of the player and the zombie and will change the velocity of the zombie in the direction of the player. The difficulty in the last guard is not made by the complexity of the AI just the sheer mass of numbers that are coming at the player.


Zombie Spawns

The zombie spawns are based on the location of the player. There are two large circles attached to the player, the outter circle determines the zone in which the zombies can spawn, the inner circle is a zone that the zombies cannot spawn, this is just out of view of the camera to give the player a sense of masses of zombies spread throughout the play zone. The zombies are also restricted from spawning on zones that the player cannot reach. The spawn script has a while loop which determines whether a random location in the radius is in a spawn zone (ie. not in the inner circle or the unreachable zones) if it lands in a valid spawn location it will terminate the while loop and spawn a zombie. The rate of which the zombies spawn is determined by the current game timer which adds an additional zombie spawn every 30 seconds. Zombies spawn every 1.5 seconds with more spawning at each interval further in the game.

Figure 3.
Figure 3. Zombie spawn zone

Files

Build.zip Play in browser
Oct 05, 2022

Leave a comment

Log in with itch.io to leave a comment.