Do you have to do a constrain and magnitude for enemies, to stop animation ?

fadamionfadamion Member, PRO Posts: 309
edited June 2012 in Working with GS (Mac)
So i have some heavy animation on my enemies and thought i might add code to turn off there animation if they are not on screen. Is the only way to do this is a constrain and a magnitude? I would think all the extra constrains would eat up resources?

The animations are 8 directions 6 frames per direction 12 caricatures all recycling not spawning.

and this would be my constrain.
magnitude( self.Position.X - game.playerX , self.Position.Y - game.playerY )

Best Answer

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    edited June 2012 Accepted Answer
    I read in your other thread you are recycling actors so let's say you park your unused actors off screen at the top. Make a condition in your animate rule that says when attribute self.position Y is < 480 (portrait) 320(landscape) that way it will not animate unless it's self position is in the play area. One of the keys of learning to program in GS is learning to think like a computer.
Sign In or Register to comment.