Enemies and Interaction


Implemented four main types of enemies: mallards, mandarin ducks, Muscovy ducks, and ducklings. Three of these enemies (mallards, Muscovy ducks, and ducklings) have relatively similar behaviours - they continuously approach the player, harming them upon contact. They each have slightly different stats, however - ducklings are fast but have low health and attack strength, while Muscovy ducks are slow but have high health and attack strength (mallards are average in all stats). Mandarin ducks approach the player until they are a certain distance away, at which point they will stop moving - while approaching or stationary, they throw damaging projectiles towards the player. If the player approaches a mandarin duck, they will flee - while fleeing, they will not throw mandarins. The movement scripts for these enemies were lightly modified from the Mover scripts used in the tutorials; for the mandarin duck, the shooting script was modified from the scripts used for the player's weapons.

During the game, enemies spawn from set locations every couple of seconds. The enemies that spawn are random, and change each time the game is played. The script for the spawner was modified from the BasicSpawner script from the tutorials.

When touching the player, enemies deal a set amount of damage each half-second. The amount of damage dealt depends on the enemy type - Muscovy ducks deal 8 damage, while ducklings only deal 2. Mandarin ducks deal a small amount of damage when touching the enemy, but most of their damage is dealt by their projectiles, which damage the player before disappearing. When the player's health is at or below 0, they are defeated and the game ends.

Enemies also have their own health values, which decrease when the player shoots them. Each enemy has a different HP value - Muscovy ducks have 30, while ducklings only have 6. Each gun deals a different amount of damage - for instance, assault rifles deal 2 damage per bullet, while revolvers deal 10. When an enemy is defeated, the player's score value increments by 1.

When the player's score reaches a certain threshold, a boss duck will spawn. Boss ducks are significantly larger than other enemies, and have substantially more health and attack strength. When defeated, boss ducks increment the player's score by 10. The script for spawning bosses was further modified from the BasicSpawner script - to prevent multiple bosses from spawning at a single spawner at once, the threshold for spawning a new boss increases each time one spawns (for example, if the initial score requirement for spawning a boss is 20 points, it will increase to 40 when one is spawned).