Benjans

Performances questions

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!

Share this post


Link to post
Share on other sites

No it runs just fine on my Laptop. (Mac Firefox/Chrome)

But I don't get any cars on my Ipad/Nexus5.

 

Since I'm also new to phaser/gamedev in general I'm curious; why are you using a custom loop instead of the update() function ?

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.