Today I covered weapons health, and lives.
Weapons:
Weapons could be fired using two different methods: Fire in the direction the object is facing, or a weapon that fires in the direction where you have clicked/tapped.
For both options, a few rules have to be set:
- The object being fired needs to originate from the player
- The bullet needs to destroy itself when colliding with walls or enemies (AI)
- A variable needs to be set to control the direction the weapon is being fired in
Health (for the enemy):
Enemies will need to have a variable set at the start of the level as their health. A collision then needs to be added for when the bullet collides with the enemy. When a bullet collides, it should take some health off of the enemy, and if the enemies health hits 0, the instance should be destroyed. This means multiple bullets will be required to kill/destroy the enemy.
Health and Lives (The player):
For the player, the health and lives should be set at the beginning of the game. To do this, you create an invisible object and add it to the first screen which function is to set the variables for health and life. This should then remain throughout the rest of the game. Every time the players health hits 0, a life would be taken off.