“Asteroids Vs. Bullets Sim”:
i looked in both examples but i dont understand where i should insert the debris class into my code to make it spawn 1 every time an asteroid dies. I’d apreciate if you can have a look and explain for my example where i should add it.
class Bullet
in this class, there is a method where the explosion starts. It is called void explode () {
.
Here the debris / shrapnels / missiles are added to the ArrayList missiles
. Yeah. Call it where YOUR asteroid dies.
In draw also call ExplosionManager()
to let the debris fly.
before setup():
// for explosions (these are actually Shrapnels)
ArrayList <Explosion> missiles;
IN setup():
// explosions: Create an empty ArrayList
missiles = new ArrayList<Explosion>();
Chrisir