Spawn/Destroy/Spawn
Hi guys,
I have an issue with spawning actors. I want to spawn the same the same actor (let’s call it checkbox) 5 times in random locations but in the following order:
- actor spawns
- destroyed when collide with main actor
- Spawn same actor spawns to random location
- destroy/spawn/destroy/spawn 5 times
- after the fifth time skip to next screen
I have created a spawn actor that spawns my ‘checkbox’ to a random location. I have created an integer (Numberofitems) and created a rule within my spawn actor:
game.NumberofItems =/< 5
then
Spawn Checkbox
Change Attribute game.Numberofitems to (game.Numberofitems)+1
What it does is it spawns one “checkbox” in random location, but it does not respawn it after destroy. I tried to create Loop but I couldn’t make it work. I would ideally like to avoid creating a timer if possible.
It bugs me because I feel there should be a simple fix and yet I can’t make it work for the life of me. :( What am I doing wrong?
Comments
Is this code in your "Checkbox" actor?
game.NumberofItems =/< 5
then
Spawn Checkbox
Change Attribute game.Numberofitems to (game.Numberofitems)+1
If so, once the "Checkbox" actor is Destroyed this code is destroyed too so it will never run. I usually use an offscreen actor as a game controller what would watch for and control things like this.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
No, this is in the “spawn actor”. :(
So if I understand correctly your off screen actor is what I call the “spawn actor”. The one that spawns the ‘checkbox’ to random locations
@ucjuak5 , yes it sounds like the same thing. :)
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page