Jump to content

Phaser Timer, P2 and performance problem


andrii.barvynko
 Share

Recommended Posts

Hi there,

I have a problem with game mechanics on mobile devices. Mechanics connected with timers. For example, I have a physics character (using p2 physics), which fly up during some time, then falling down. So the problem is my character fly on different heights on different devices. I think it's a problem with performance and game fps. I've tried to connect mechanics with game.time.fps - but it's don't help. Maybe anybody have some ideas what is going on?

This is the part of code for example:

function fly() {
    if (timer1.ms < force + 50/*I've tried to add fps here, but no effect*/) {
        sprite.body.data.gravityScale = -2;
    }
    else if (timer1.ms > force - 50) {
        sprite.body.data.gravityScale = 2;
    }
}

var timer1 = application.game.time.create(false);
timer1.repeat(myTime, 3, fly);
timer1.start();

I use phaser 2.4.4

Link to comment
Share on other sites

Really? Thank you for your feedback. I'm not sure of course. Yes, I use scale mode - Phaser.ScaleManager.RESIZE
But I'm very careful, and keep all game proportions.
So, it may be, and I'll test it again, but I'm not sure this is the main problem. I've tested on many high performance devices with different screen size, testing with chrome dev tools... And everything was okay.

Link to comment
Share on other sites

I test it, and unfortunately it issue not connected with screen dimensions. On old devices (not very old, samsung s3 for example) game lagging sometimes. And after that I have problems with timers. In addition, when I turn on advancedTiming the game performance decreases, so I can't test it with fps indicator...

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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