Jump to content

Game lags after a while


Jessicaward25
 Share

Recommended Posts

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

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...