Using collisions for game interactions
To make it fun to play the game, we want to add the following gameplay features:
- Two types of weapons (sword and axe) can be placed in the game level. The player should walk through a weapon to pick it up. If the player character already has a weapon, when they pick up another weapon, the old weapon is dropped.
- When an enemy is activated, spawn a hammer weapon for the enemy.
- Defense towers should be placed in the game level. If the player character enters and stays within the attack range of the tower, the tower fires at the player character by spawning fireballs.
- A fireball moves along its firing direction and checks whether it hits the target. If the target is hit, it deals damage and destroys itself. Otherwise, the fireball flies for three seconds and destroys itself.
Before we start working on the game, we need to import the weapon and defense tower assets.