Spawn set number of actors in random locations
OrbInteractive
Member Posts: 14
I'm trying to spawn a specific number of actors randomly around my scene and have them not overlap. So far I've only been able to get 1 to spawn when I'm expecting 5. What am I doing wrong?
Here's the rule that I have..
- if game.SpawnAmount > 0
-- Set game.SpawnAmount to game.SpawnAmount -1
-- Spawn Actor X (random direction and random x,y positions to scene)
note, the "game.SpawnAmount" is a Game Attribute I've set to 5.
Here's the rule that I have..
- if game.SpawnAmount > 0
-- Set game.SpawnAmount to game.SpawnAmount -1
-- Spawn Actor X (random direction and random x,y positions to scene)
note, the "game.SpawnAmount" is a Game Attribute I've set to 5.
Comments
For an example of looping methods, grab my demo attached here: https://forums.gamesalad.com/discussion/comment/364679/#Comment_364679
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
When actor collides with [same actor] AND self.time=0... destroy [this actor] and change attribute game.SpawnAmount to game.SpawnAmount+1.
Hopefully, the self.time=0 condition would cause the newly spawned actor to be destroyed while keeping the existing actor that was already at the location.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
1) How did you create the game attributes "Counter" and "MaxIterations" as "indexes"? I don't have the index option.
2) How are these indexes being set to a value of 500?
2) Set it manually.
The loop condition is set to stop at a counter value of 500 but you can set the rule to stop at 5 or any other value.
If you search the forums for iterative loop or timers are for chumps (see the very last few posts) you'll see more info about how loops work in GameSalad. I'm on my phone, otherwise I'd provide the links for you.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
1) Ok, ya I can't see the value of your index attributes, apparently a bug with PC/only supported by MAC.
2) Both the Every0 and TimeStamp loop from your example project use time as the condition changer(?). One using a Timer the other a Rule that checks/compares time which you will compare as false for .005 seconds before coming true again..Slick!
3) AH! *bonk to head*, your spawn looper setup is pretty much the same as mine. BUT, you are spawning the same actor as the Spawner. So, each actor that spawns will evaluate the rules and spawn another.
Live and learn.
thanks for the help fellas.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
: )
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Yep, agreed, put stuff in, watch it evolve, when it produces something useful then steal it !
: )
Cast your note-in-a-bottle into the GameSalad sea. Then one day watch it drift back to you all bejeweled with the beautiful barnacles of others' additions. Dry it out. Give it a good coat of lacquer. And display it as the candle holder it was always destined to be!
(Jeesh -- I have no idea where that came from!)
I am not able to respawn my actor
I've used timer
everything else is fine as I am following a youtube video
the problem i think can be possible is different co-ordinates
and to be honest I am a newbie
can anyone please spare their precious time and help me troubleshoot this issue ? thank you.