penpen5624 Posted July 3, 2014 Share Posted July 3, 2014 Hello everybody, I've just made a game with PhaserJs 1.1.3. This one work very well on web browser but on mobile ... I've used CocoonJs to improve the performance. It's better (53-60 fps) but when I do an action (jump) the number of fps fall at 43 fps. So, It's very unpleasant to play. I very optimize the game : remove unneccessary calculation, replace the division (/2) by ( x 0.5)... So, I would like know what is the best html5 framework to made arcade game with CocoonJs (the best for the performance). Thanks for your futures responses Quote Link to comment Share on other sites More sharing options...
remvst Posted July 4, 2014 Share Posted July 4, 2014 The issue probably comes from your code, not from CocoonJS specifically. Maybe you are performing too many operations in the game loop when the player jumps. We'd need more details to help. Quote Link to comment Share on other sites More sharing options...
penpen5624 Posted July 4, 2014 Author Share Posted July 4, 2014 I guess It's because they are several objets in movement in the same time. If I paused the other objects it's fast. May be with Phaser.Webgl mode it's be better, no ? The jump function :jump: function() { var min = 20, min_r; this.men.forEachAlive(function(r) { if (r.jump == false && r.pos < min) { min = r.pos; min_r = r; } }, this); var man = min_r; if (min != 20 && !man.t.isRunning) { this.change_level = true; //calcul of position of jump because It's variable var x = w * 0.5 + (this.circle.width * 0.5 + hauteurSaut) * Math.cos(man.rotation - Math.PI * 0.5); //40 var y = h * 0.5 + (this.circle.width * 0.5 + hauteurSaut) * Math.sin(man.rotation - Math.PI * 0.5 ); //40 man.t2 = this.game.add.tween(man).to({ x: x, y: y }, 250).to({ //200 x: man.x, y: man.y }, 380); //400 man.t2.start(); man.jump = true; score += 1; localStorage.setItem("score",score); //Fix bug Cocoon because There were a problem of refresh score. (the score get above of the precedent ...) this.world_label.destroy(); this.world_label = game.add.text (w * 0.5, h * 0.5, score, s2); this.world_label.anchor.setTo(0.5, 0.4); soundJump.play(); } },I don't see what I could remove on this code. If you see anything to modify. Do not hesitate. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.