As a follow up to the background scrolling example, I’ve modified the 1945 code again to emphasize how the shooting mechanism works.

shooting mechanism example

Basically, the player is given two options for shooting:

  1. Every distinct click of the left mouse button guarantees one shot.
  2. Holding the left mouse button will make shots appear at regular intervals (rapid fire).

In a way, this gives the player the incentive to click if he wants a more rapid rate of fire, since you can effectively increase the intervals at which rapid fire gives off shots.

Feel free to ask questions! 🙂

shooting mechanism source code