I have two objects 1 player and 1 enemy i want that if space is pressed spawn bullet but i also want that only one can be spawn at a time (i have used Groups,Variables etc.) Could anyone give me a live example (The player and enemy can shoot at one time but player can not shoot if is last shot bullet was not destroyed and same was the case of enemy)
You can add an instance variable to your player called "bulletCount". When you shot the bullet set it to 1, when you destroy the bullet set it to 0.
Then on you fire bullet event add a condition, if "player.bulletCount = 0".
It will take long as i have many layouts and event sheet? any other ideas?
What Joskin said is the best way. It's always important to build the foundation of your project early on to avoid having to go back and tediously change things.
Can i do that by Adding a group that is disabled and whenever player wants to shoot it will set the group active and the group will further check variables and decide whether player can shoot or not?
Develop games in your browser. Powerful, performant & highly capable.
Do as you want, there are multiples ways to achieve this. Do the easiest one for your system !
You can always add how far player bullets has travels and then destroy it. say for example player bullet travel distance > then 400 pixel then destroy player bullets this way soon as player bullet is destroyed player can spawn another