While it’s all well and good being able to fire laser beams, true heroes need access to more than one weapon to save the universe! This quest will see you reinforcing some of the lessons you have learned throughout the initial steps while also making the game more fun for players.

Task Definition

This task involves adding a special ability that the player can use to fire a secondary weapon a limited amount of times per playthrough. Adding a secondary weapon will typically require the following elements.

  • The player should be able to push a button on the keyboard to fire a bomb.
  • When the player fires the bomb, it should launch a special attack that could destroy multiple enemies at once.

Hints

You might want to add bombs to your game by following these steps…

  1. Add a variable to your game which keeps track of how many bombs you have left.
  2. Show that variable on the screen like with lives or the player’s score.
  3. Whenever the user presses ‘X’ on the keyboard, spawn 10 bullets in a horizontal line and send them going up the screen. At this point, subtract one from the ‘bomb count’.
  4. When the user has zero bombs left, you shouldn’t let them fire any more!