Step 9

Set up overlap

Next we will set up what happens when our player is attacks an enemy.

With an overlap we must set up when a Projectile comes into contact with the Enemy type.

WHen this happens the ‘otherSprite’, our ghost, will disintegrate and be removed from the game.

Add score

The last block inside our overlap will be to change score by 1.

This will increase our scoreboard point for every ghost the princess hero attacks!

Spawn the ghost!

The next step will spawn the ghost every 2 seconds.

To make the game challenging we are increasing the ghost speed variable by 5 for every new ghost that is created.