BkoChan Posted September 21, 2016 Share Posted September 21, 2016 I'm looking to add game speed buttons into my Phaser game (paused, x1, x2, and x5). I'm not really sure how to achieve this at all! Is it possible to call the main update method from within the update method?! After doing some Googling a lot of people suggest just calling my own update function multiple times from the Phaser update. I'm not really sure how that would work. If I have a sprite with arcade physics I want Phaser to make sure that the physics are applied?! Link to comment Share on other sites More sharing options...
samme Posted September 21, 2016 Share Posted September 21, 2016 Yikes, no, just use game.time.slowMotion. And if you use tweens set them to frameBased. Link to comment Share on other sites More sharing options...
BkoChan Posted September 22, 2016 Author Share Posted September 22, 2016 19 hours ago, samme said: Yikes, no, just use game.time.slowMotion. And if you use tweens set them to frameBased. Unfortunately this is the opposite of what I need. I want to be able to speed the game up Link to comment Share on other sites More sharing options...
samme Posted September 22, 2016 Share Posted September 22, 2016 Use a fraction for fast-motion: game.time.slowMotion = 1 / 5; Link to comment Share on other sites More sharing options...
BkoChan Posted September 23, 2016 Author Share Posted September 23, 2016 16 hours ago, samme said: Use a fraction for fast-motion: game.time.slowMotion = 1 / 5; This, sadly, doesn't work. It seems like the value cannot be lower than 1 Link to comment Share on other sites More sharing options...
samme Posted September 23, 2016 Share Posted September 23, 2016 You may hit a performance limit, but it should work: http://codepen.io/anon/pen/ZpZbzb?editors=0010 Link to comment Share on other sites More sharing options...
BkoChan Posted September 23, 2016 Author Share Posted September 23, 2016 42 minutes ago, samme said: You may hit a performance limit, but it should work: http://codepen.io/anon/pen/ZpZbzb?editors=0010 Ok, so it seems like slowMo will go lower but it doesn't affect some things! It's not updating velocity http://codepen.io/MichaelDilloway/pen/QKpjoN?editors=0010#0 Link to comment Share on other sites More sharing options...
samme Posted September 24, 2016 Share Posted September 24, 2016 You're right. It turns out you have to set `game.forceSingleUpdate = false` and (probably) scale desiredFps: Link to comment Share on other sites More sharing options...
Recommended Posts