Help spawning actors in and out of scene continuously!!!!
![Mikv616](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hey everybody. I've been recently working on a game that has an actor flying out of space from earth and there will be other actors that will spawn randomly in. Well my question is how am I suppose to spawn those actors in randomly and have them move out the screen when the actor passes by them constantly because the game is endless without it lagging?
(
![:( :(](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/frown.png)
Best Answers
-
AcceleratedGames Posts: 201
Put this rule into the enemies: If attribute game.MainCharacterPositionY > self.Position.Y + (game.Screen.Size.Hight/2)+(self.Size.Hight/2), then destroy. -
AcceleratedGames Posts: 201
This is destroying the actor as soon as it is not visible on the screen.
Answers
1. You don't have to make sure that the distance the wall is from the scene is as far as your tallest actor.
2. You don't have to put another actor in an already actor heavy scene.
3. The actor won't stay active any longer than it needs to, which saves memory.