How to not let actor spawn where other actor is
Mayhem_Madness
Member, PRO Posts: 168
how do i not let an actor spawn where a different actor is, my different actor is in the bottom right of the screen.
I would like it to spawn anywhere else on the screen except where the different actor is.
Thankyou.
Thor.
Comments
anyone?
Can you explain more about what you're trying to do -- in a larger context?
It's easy enough to prevent an actor from spawning exactly where another actor is but I'm guessing you want the next spawned actor to spawn somewhere there is currently no other actor and that you might have more than one such actor on the scene. That's harder. So more details would be helpful.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
One way might be to just check for a collision when the actor is spawned, if it is colliding with another actor it shouldn't, destroy it and re-spawn it in a new spot. Then repeat the check...
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thankyou tatiang and jamie_c for the advice, i think i have worked it out now.
Hi tatiang, I thought I had it working, but it's not. All I wanted was the actor to spawn In between two actors one at the top of the screen and one at the bottom of the screen. Both actors cover the whole width of the screen.
Thanks.
Thor.
Here's a demo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thankyou tatiang
i see you have put
280 in the y position section in the spawner actor, could you tell where you got that number from because I'm a bit confused.
Thankyou.
Thor.
280 is the self.Position.Y value for the top barrier actor. If you double-click on the top barrier actor, you can check it's position. This, of course, could be any value you like.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thankyou for explaining that