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

Performances questions


Benjans
 Share

Recommended Posts

Hi everyone,

 

Just begining with Phaser, i love the phylosophy and how it works :)

For my game, I'm drawing a big tilemap (100 x 100), adding static objects with no problems.

Then I want to add moving objects, so I create a group and add sprites to the group, with a simple velocity.

And... it doesn't work very well. It seems like each time a new sprite is attached to the group, the animation stops, then restart, so it's not smooth at all :(

Maybe I'm doing something wrong, but I don't think so (i'm properly destroying objects).

I tried with Tweens too, but the result is the same.

 

You can check it here : http://benjans.byethost3.com/city/

 

Thank you for your help guys!

Link to comment
Share on other sites

Yeah. what Pixelguy said above. Why are you running your own gameloop, and with setInterval at that? setInterval is in no way accurate enough to use for a game loop.

At the very least you should be calling requestAnimationFrame, but then you would be throwing away all of the methods that Phaser already provides you in the update() function.

Link to comment
Share on other sites

Hey guys, thank you for your reply. I'll try to add more cars to see if it's still smooth...

My game is based on Cookie Clicker mechanism: every second, a new inhabitant comes to your town.

Update is called 60 times per second, the goal of the update function is to run as often as possible, not at a regular interval.

That's why I used setInterval... Maybe I'm doing wrong?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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