jerry Posted October 27, 2015 Share Posted October 27, 2015 I believe phaser updates every sprite added to the game( I tried to set alive=false/autoCull=true/visible=false, none of them prevent updating.)But it seems in many games, enemies only move and shoot when they r in the camera view or reach to a certain distance to the hero. I think this is more effective.Any one know how to disable updating when a sprite is out of camera view, and enable it when it's in camera view. Thanks. Link to comment Share on other sites More sharing options...
chongdashu Posted October 27, 2015 Share Posted October 27, 2015 Maybe, Phaser.Sprite.exists in conjunction with Phaser.Sprite.checkWorldBounds and its corresponding onOutOfBounds and onEnterBounds events? Link to comment Share on other sites More sharing options...
YuShaN Posted October 27, 2015 Share Posted October 27, 2015 sprite.setAll('outOfBoundsKill', true);sprite.setAll('checkWorldBounds', true); Maybe like this? Link to comment Share on other sites More sharing options...
in mono Posted October 27, 2015 Share Posted October 27, 2015 I think you might want to try setting autoCull to false on that sprite. http://phaser.io/docs/2.4.4/Phaser.Component.AutoCull.html#autoCull Link to comment Share on other sites More sharing options...
Recommended Posts