Help spawning actors in and out of scene continuously!!!!

Mikv616Mikv616 Member Posts: 28
edited July 2012 in Working with GS (Mac)
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?
:((

Best Answers

  • AcceleratedGamesAcceleratedGames Posts: 201
    Accepted Answer
    Put this rule into the enemies: If attribute game.MainCharacterPositionY > self.Position.Y + (game.Screen.Size.Hight/2)+(self.Size.Hight/2), then destroy.
  • AcceleratedGamesAcceleratedGames Posts: 201
    edited July 2012 Accepted Answer
    This is destroying the actor as soon as it is not visible on the screen.

Answers

  • Mikv616Mikv616 Member Posts: 28
    Thanks AcceleratedGames so if I add this attribute what is it exactly doing?
  • Mikv616Mikv616 Member Posts: 28
    Thanks so is this better than having an actor below the screen(stage) where if it collides with these actors it will destroy it. Making it lag less?
  • AcceleratedGamesAcceleratedGames Member Posts: 201
    edited July 2012
    Yes, it is better because:
    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.
  • Mikv616Mikv616 Member Posts: 28
    Okay Thanks for the Tip!
Sign In or Register to comment.