Spawn/Destroy/Spawn/Destroy...
Hello the best community on the planet!!
I have one actor (button) that when is pressed he spawns 5 new actors. And now i can't figure out how to make when i press again that actore (button) to destroy those 5 spawned actors.
So basicly I want this - Button pressed spawns 5 actors, Button pressed again destroy 5 actors he spawned, Button pressed spawn 5 actors, Button pressed again destroy 5 actors he spawned ...
this is maybe important to say, button always spawns same 5 actors
and also i don't wan't my button to be destroyed just the actors he spawned.
Please help mi out guys !
Best Answers
-
Summation Posts: 476
@kreso123456 said:
Hello the best community on the planet!!I have one actor (button) that when is pressed he spawns 5 new actors. And now i can't figure out how to make when i press again that actore (button) to destroy those 5 spawned actors.
So basicly I want this - Button pressed spawns 5 actors, Button pressed again destroy 5 actors he spawned, Button pressed spawn 5 actors, Button pressed again destroy 5 actors he spawned ...
this is maybe important to say, button always spawns same 5 actors
and also i don't wan't my button to be destroyed just the actors he spawned.Please help mi out guys !
You could make the spawned actors' existence contingent upon a game level attribute like 5alive.
In the spawned actors make a rule that says if 5alive=1, destroy actor.
You can keep the spawning behavior in your button, but add a toggle in your touch behavior that switches back and forth between 1 and 0.
This way you can touch, they spawn, touch again, they die, etc. -
MentalDonkeyGames Posts: 1,276
Is this even close to what you´re looking to achieve @kreso123456 ?
Made with Mac creator 0.13.7
Answers
Can you do that using an integer?
On press change attribute to +1
Then spawn when the integer is = 1
And destroy when it's = 2
Maybe run a timer that resets it after 2 seconds
Might be an better way but thats all I can come up with.
@Summation
Could you just tell me how to do that?
I am kinda new to gamesalad
Probably the simplest way is to make use of a boolean.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
@Summation
I seem to have a little problem here.
i should have told this earlier but i am total noob
And i really need you to tell me step by step on what to do next
sorry but I am really, really new to gamesalad and only at the beginig of the learning phase. I WOULD APRECIATE YOUR TIME AND HELP ALOT!
@NipaDidIt AWESOME!!! thank you!!!
I just change it a bit because i need my actores to spawn at the right XandY and not randomly but that is it!! THANK YOU VERY MUCH you are awesome!
No problem, glad i could help
Mental Donkey Games
Website - Facebook - Twitter