How can I make spawned actors accelerate, then destroy themselves and come back?
Samster
Member Posts: 6
So i'm working on a game were there are asteroids flinging at you, and I was just wondering, how do I create the set rule to where the asteroid flings at you, goes off screen and then destroys itself and goes back to its original location to loop it every 5 seconds?
I know it's a bit complicated, but it would mean a lot to me if you could help!
Comments
When actor collides with [wall actor placed around edge of scene] or [x and y position indicate off-screen] then change attribute self.Position.X to [original X] and self.Position.Y to [original Y].
I'm not sure what you mean by 'loop it every 5 seconds'. Is the 5 seconds the time it takes to re-spawn? Is it the time the asteroid is on the screen before it resets?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I mean using the timer to respawn it every five seconds in it's starting position.
Also, how can I find the original X and Y?
To find the original position, change attribute self.originalX (real) to self.Position.X and the same for Y.
To reset the position every 5 seconds, use a timer to change self.position.X and Y to self.originalX and Y.
You can spawn and destroy if you prefer but there's probably no need.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User