Click or tap to fire an artillery shell. Hold to fire multiple shots.
These bullets are affected by gravity so they make a parabolic arc to their target.
This example introduces a function getExplosion() which either creates a new explosion object or re-uses one that was created earlier. This approach allows the number of explosion sprites to increase dynamically but never creates more than are needed to display on screen at any one time.