Hello. New to this program and ran into a little trouble and was hoping someone could help me out.
I’m trying to find a way to make it so that when a player fires a projectile, they cannot fire another one until that projectile has left the screen or been destroyed (by collision or otherwise). I can fire projectiles, and have it so I won’t fire multiple when being held down, but I cant think of the logic that would limit the rate of fire (other than time a timer). Any help would be appreciated!
I guess that you have an event that fires bullets.What you could do is add to it a condition “instances on the scene = 0” and add the “destroy when outside the screen” behavior. That way, when a bullet exits the screen, it is deleted and a new one can be allowed to be fired.
Create a variable to the player then if the variable is = 1, the player can shoot. Then, when the player shoot, change the variable to 0. This will make the player unable to shoot again because there’s a condition that the variable is = 1 before it can shoot. When the bullet is removed, add an action that changes the variable to 1 again to make the player able to shoot again.
That really solved my problem! I was able to check number of instances of Fireball spawned and if they = 0 then allow for a fireball to be shot.(Setting this condition with the “Number of Objects” option, in case anyone else has trouble finding it like I did.) While this is a simple program to use, some of the terminology and capabilities are unknown to me at the moment.
Thank you both!