Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

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

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

 Share

  • Recently Browsing   0 members

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