danbruegge Posted September 7, 2014 Share Posted September 7, 2014 Hi everyone, what is the simplest way to pause the movement of a sprite group? When i try to pause with body.velocity.x/y it will work but when i resume, the sprite dont move again. Explained on the tanks example, what will be the best solution? http://examples.phaser.io/_site/view_full.html?d=games&f=tanks.js&t=tanks Dan Link to comment Share on other sites More sharing options...
danbruegge Posted September 10, 2014 Author Share Posted September 10, 2014 Nobody can help? Link to comment Share on other sites More sharing options...
lewster32 Posted September 10, 2014 Share Posted September 10, 2014 If the sprites are moving via physics, doing sprite.body.enable = false will pause their movement, though setting it to true again may not continue to apply any latent forces correctly (i.e. an object decelerating due to drag may not continue to slow down predictably). Give it a go and see if it works as expected in your implementation. danbruegge 1 Link to comment Share on other sites More sharing options...
danbruegge Posted September 10, 2014 Author Share Posted September 10, 2014 Awesome, it works. Thanks! The docs seems a little bit misleading in that case or did i understand it wrong? Link to comment Share on other sites More sharing options...
lewster32 Posted September 10, 2014 Share Posted September 10, 2014 No it's accurate, though it's not entirely clear that pre/post updates are the places the sprite's position is updated due to velocity. Link to comment Share on other sites More sharing options...
danbruegge Posted September 10, 2014 Author Share Posted September 10, 2014 No it was not clear. Thanks for the help. lewster32 1 Link to comment Share on other sites More sharing options...
Zaxx Posted March 17, 2018 Share Posted March 17, 2018 You also can use group.exists = true; // for pause group.exists = false; // for resume all children will be visible all time. Tested on particles too Link to comment Share on other sites More sharing options...
Recommended Posts