Jessicaward25 Posted August 6, 2015 Share Posted August 6, 2015 I've tried removing every feature that I can to make it not lag, but it still lags.. It seems to be ok when you start it up, but then after about 15 seconds or so the framerate drops. Somebody suggested it may be because the update() loop has many game.add.sprite lines.. But whenever the loop starts again the sprites are removed, which is what always happened in XNA? This is the code: http://pastebin.com/VtNUpxYu Thank you in advance! Link to comment Share on other sites More sharing options...
stupot Posted August 6, 2015 Share Posted August 6, 2015 You'll get a better response if you post a link to a playable demo. Link to comment Share on other sites More sharing options...
ZoomBox Posted August 6, 2015 Share Posted August 6, 2015 I'm OK, since you call destroy() on each sprite, it shouldn't lag.BUT still, that's not the way phaser work.You don't have to manage the draws cycle of life SO you should create your sprites ONCE (in the whole life of your playing session) and the move them. Link to comment Share on other sites More sharing options...
Jessicaward25 Posted August 6, 2015 Author Share Posted August 6, 2015 I'm OK, since you call destroy() on each sprite, it shouldn't lag.BUT still, that's not the way phaser work.You don't have to manage the draws cycle of life SO you should create your sprites ONCE (in the whole life of your playing session) and the move them.Thanks So what would I replace game.add.sprite with? We tried just incrementing the X position, but then no matter what we did we couldn't get gravity to work, so would there be another way of moving the sprite? Link to comment Share on other sites More sharing options...
ZoomBox Posted August 6, 2015 Share Posted August 6, 2015 You have to do things in the right order/ Actually, you should try to make a simple project work and then see what's missing/wrong in your.You should try it in the Phaser Sandbox (this template http://phaser.io/sandbox/edit/2 will do the job). And what's great with the sandbox is that you can share a working piece of code when something's wrong with it. Link to comment Share on other sites More sharing options...
ZoomBox Posted August 6, 2015 Share Posted August 6, 2015 Look at this, I tried your way and it works:http://phaser.io/sandbox/SnRbeGNV Link to comment Share on other sites More sharing options...
Recommended Posts