Touch event with spawned actors
xacto
Member Posts: 146
Having an issue with some code. I have made an actor that I want to spawn 4 times in a scene. So I set up another actor to create a timed spawn. Everything spawns ok.
What I am looking to do is when a user touches an actor it is destroyed. However, what happens is once I click on one of them.... all my NEW spawns will show itself then destroy itself after a second. If I placed separate actors without spawning - it works like it should. (only spawning does not work)
http://farm3.static.flickr.com/2569/4007452006_1f62f146c2_o.png
Seems simple enough. Any ideas?
What I am looking to do is when a user touches an actor it is destroyed. However, what happens is once I click on one of them.... all my NEW spawns will show itself then destroy itself after a second. If I placed separate actors without spawning - it works like it should. (only spawning does not work)
http://farm3.static.flickr.com/2569/4007452006_1f62f146c2_o.png
Seems simple enough. Any ideas?
Comments
Timer: Every 2 seconds
- Spawn Actor, front layer, relative to scene
- Change attribute game.Gcount to game.Gcount+1
Then the "code" would read:
If touched they die, otherwise if not nothing else happens they die after five seconds.
Again, I don't know, it doesn't look like it will fix the issue you're having but I think it'd clean your "code" up a bit. It's something to try. It's what I'd do I think, but I'm new.
Have a look at "Spawn, Touch, Destroy", http://gamesalad.com/game/play/24792
The "spawner" is the red box at the center, Gcount is represented at top left, Score is represented at top right.
I made it so you could download it and compare it to your own.
Hope this helps.
Steve
Ok this is strange.... your code does exactly what mine does. It works for maybe one or two clicks -- then they just spawn and "destroy" with no interaction at all. Quick blinks....
Unless my plug-in is messed up (maybe the case).
Can you see if this is the same for everyone else? (see link)
http://gamesalad.com/game/play/24792
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I tried downloading the project, but it comes up as a Chess game and gamesalad won't open it.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Instead of "Actor receives event Touched is Pressed"
I switch it to
"Actor receives event Mouse Button is Down"
"Actor receives event Mouse Position is Inside"
Maybe it's a bug with the touch command?
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
So, what does the "touch is pressed" suppose to do?
Anyone from gamesalad know if this is a bug?
a .game file is just a .zip file. So just rename it with the .zip extension and you will get your .gamesalad file.
Anyway to fix this bug - or is there a work-a-round to this?
Guess I will have to shelf this game until it is fixed.