Posted September 23, 2023 by georgie
Implementation
The checkpoint for this week's implementation is enemies and interaction. As hinted at in previous devlogs, I drew up a simple zombie enemy to wander throughout the world. To implement some kind of interaction for this checkpoint, I started with the basics - health, enemy behaviour, and damage from enemies.
To capture the nostalgic nature of arcade games, I introduced a classic three-point health bar in the form of a purple three-heart UI. Intended to be the same colour as Davey's guitar, these hearts serve as the visual representation of his health. The health slider UI was integrated with a dedicated player health script attached to Davey's game object. After testing that a simple, rectangular slider reacted to health loss as intended, the purple hearts were then applied to the slider in the form of a mask, framing the hearts into the shape of the slider. Currently, the heart UI diminishes gradually, though the intended effect is for the hearts to recede one at a time; this will hopefully be implemented in a future build.
Health loss, of course, would not be possible without some kind of collision interaction, and that is where our trusty damage collision and player health scripts comes in. Upon collision with any enemy, a gradual damage-dealing process is initiated, decrementing the player's health as collision continues. This damage effect ceases as soon as the player character stops colliding with the enemy object (or, he dies), ensuring that health reduction only occurs during contact with enemies. Upon loss of all health, the player character dies by being deleted from the current game instance.
Current implementation of the health UI and player-enemy collision.
As part of my enemy implementation, I made the decision to not use any kind of sophisticated program for navigating the world, for three reasons: time taken, simplicity's sake, and for the fact that zombies are "braindead" - it seems realistic (and hilarious) that they would not take notice of objects. The player may be able to use this oversight to their advantage. Instead, the zombies have a "wandering pursuit" script, wherein they periodically walk in a random direction, but will pursue the player if they are in range. The player can escape the zombie's chase, though this range is double the initial pursuit range.
The zombies also contain their own health script, a simplified version of the player health script: health points can be set, and upon complete loss, the zombie is deleted from the game instance. Currently, zombie health cannot be tested until player attacks are implemented.
Enemies returning to wandering if out of range.
Following this development log, I will begin to implement player attacks, item pickups, and a wave-based enemy spawner.
User Feedback / Improvements
User feedback for this week was obtained via casual face-to-face interactions, wherein I asked for general suggestions and feedback:
Alternative Approaches