How do I make my actor spawn when touched once, and stop spawning when touched twice.
sswisehaupt
Member, PRO Posts: 76
I would like my actor to spawn when touched and stop spawning when touched twice.
Best Answers
-
http_gamesalad Posts: 1,340
https://www.dropbox.com/s/ucm8q7xxiwhui7f/Spawner template .zip?dl=0
Sorry I just saw your comment about destroying when its off. Hope its what you want good luck! Tell me if it works
-
http_gamesalad Posts: 1,340
The spawner template I sent isn't working when you downloaded it? Or.. you tried to incorporate the coding from the spawner template I made for you in your game and its not working?
-
http_gamesalad Posts: 1,340
Okay no problem , don't sweat it! Can't wait till you release your app! I'll be your first download for sure . Good luck !
Answers
Can you explain this a bit more? Do you want the actor to spawn other actors? Do you want this to happen inside a timer (e.g. every second) until the second touch? And do you mean a double-click/tap?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I mean I want the actor to spawn other actors when I tap on it. Then when I tap twice on the spawning actor I want the spawn to stop. The actor is spawning a menu type to show the user what items he has collected.
Can this be done???
Okay make an integer game attribute call it tap
then do
when touch is pressed
do (change attribute behavior ) game.tap to (game.tap+1)%2 (if someone taps it again after the second time it'll start spawning again) If you just want it to happen only once do game.tap to game.tap+1
Then where your spawner is make attribute on top and say
game.tap < 2
do spawn
set the game.tap to 1 so as soon as you press it it stops the spawn
You know ill just make a template as soon as I'm out of school cause I don't think I explained that well! Give me a few hours or less
Thanks. Will it take away the already spawned actors? That would be great if it could.
do you want it to spawn continuously when its touched once or?
so i know how to set it up
I would like to to spawn when touched, and take away spawn (what has already been spawned) when touched again. Then when touched again, spawn, and so on.
Hi @sswisehaupt Try this then: make an integer called SpawnLiveorDie
In your actor to be spawned, the Prototype one in the Inspector, put in its Rules:
Now in the actor that spawns:
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
l will try that. Thanks a lot. I had been stumped. Let you know if it works, but might not be until tomorrow.
There you go!
Thanks for all your replies. I have set your dropbox spawner template up like shown, but for some reason its not working. When I preview the template you sent, thats what I want, to stop spawning and destroy all spawned actors. Not sure what I am doing wrong. Gyroscope, it flashed my spawned actors and nothing else.
I got it to work. I'm so excited. Thank you very much. I went back and checked all my rules and one was off. I used the spawner template. Thank you so much.
Glad you got it sorted by using the template from @http_gamesalad
If, in my version, the spawned actor flashed and disappeared, my guess is you didn't nest the rules, or you set SpawnLiveorDie to 1, not 0 to start. Either way, it doesn't matter now, you're sorted.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps