valentinaCom Posted September 17, 2014 Share Posted September 17, 2014 hi I have a game in which each question in level have a different number of kids (spritesheets) on stage.I load and add all the spritesheets of kids when level start, however I turn all kids to alpha=0 (in each question are different kids). when a new question start, the kids needed turn to alpha 1. Until now I have maximum 2 kids at the same time in question and it's work perfectly. However I made a new level with 3 kids. When I turn the 3 kids to visible, the game becace really slow and I don't know why.. if I put the command alpha as a comment, it's work fine again (just that the kids are steel alpha 0). Doesn't work: playAnim:function (id) { this[id].alpha = 1; this[id].animations.add('run'); this[id].animations.play('run', 15, true); }, Work: playAnim:function (id) { // this[id].alpha = 1; this[id].animations.add('run'); this[id].animations.play('run', 15, true); }, Can anyone tell me what's the problem?? Link to comment Share on other sites More sharing options...
rich Posted September 17, 2014 Share Posted September 17, 2014 Don't set the alpha, set the 'visible' property. That will stop them rendering. However if you don't need them to even process any update logic, then set them to 'exists = false' until you need them, then they won't update their main loops either. Link to comment Share on other sites More sharing options...
valentinaCom Posted September 17, 2014 Author Share Posted September 17, 2014 I tried. I also used kill and revive instead .. but It's still lagging Link to comment Share on other sites More sharing options...
rich Posted September 17, 2014 Share Posted September 17, 2014 Then it's most likely something asset related. Size of the animation, sprite, speed, device, etc. Hard to say without an example. Link to comment Share on other sites More sharing options...
valentinaCom Posted September 17, 2014 Author Share Posted September 17, 2014 but the animation is loaded already.. the only problem is if it's visible or not.. I don't understand Link to comment Share on other sites More sharing options...
Recommended Posts