andrii.barvynko Posted February 3, 2016 Share Posted February 3, 2016 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 More sharing options...
tips4design Posted February 3, 2016 Share Posted February 3, 2016 Are you sure it's due to FPS? It can also be if your game has different width/height on different devices and your objects are scaled. If everything is scaled up or down you should node that also velocities are scaled and the object sizes. Is your game sized fixed? Do you scale with CSS or by changing game size? andrii.barvynko 1 Link to comment Share on other sites More sharing options...
andrii.barvynko Posted February 3, 2016 Author Share Posted February 3, 2016 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 More sharing options...
andrii.barvynko Posted February 6, 2016 Author Share Posted February 6, 2016 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 More sharing options...
Recommended Posts