Hello,
I'm creating a 2D sidescroller in which the player has a cannon. I created a sphere for the cannonball, and each time the player presses a certain key I'd like to create a new cannonball object and lob it in the air.
I created one cannon ball (sphere) and created an FSM for it. As soon as the cannon ball comes into existence, i add a force to get it to fly in a nice trajectory. If it collides with either the ground or anything tagged as an enemy it destroys itself.
My issue is that one cannonball has to exist when i start my game. When it drops to the ground it destroys itself, taking the object and FSM with it (so I can't make a new one). If I press the key over and over as soon as I press play it will fire cannonballs like I want, until the original hits the ground and destroys itself. If anyone knows how I can fix this behavior, or if there is a tutorial somewhere on bullet/projectile creation, it would be much appreciated! Thank you very much.