Dalton Jay Romasanta Posted September 20, 2017 Share Posted September 20, 2017 Hi, this is my first HTML5 game using Phaser, I found this gem https://github.com/BonbonLemon/basketball because I have a project to create a basketball game and it is very similar from what I needed. My concern is how can I remove the frame drop. Because every time I play the frame drops ridiculously. Both in Desktop Chrome and Smartphone Chrome. All the assets are in low resolution. I can't find a fix why this happens. I hope someone can help me. Thanks! Link to comment Share on other sites More sharing options...
samid737 Posted September 20, 2017 Share Posted September 20, 2017 I remember this had something to do with sprites being added every frame in update when the ball is thrown: For smart phones (and in general), its better to bundle all your images to one texture atlas. You can use TexturePacker to combine all images to one atlas. Dalton Jay Romasanta 1 Link to comment Share on other sites More sharing options...
Dalton Jay Romasanta Posted September 20, 2017 Author Share Posted September 20, 2017 1 hour ago, samid737 said: I remember this had something to do with sprites being added every frame in update when the ball is thrown: For smart phones (and in general), its better to bundle all your images to one texture atlas. You can use TexturePacker to combine all images to one atlas. Hi samid737, I appreciate your reply. I saw your snippet from the other post. Do I have to remove adding a sprite from the update? Link to comment Share on other sites More sharing options...
samid737 Posted September 20, 2017 Share Posted September 20, 2017 Yes. This part deals damage: if (ball && ball.body.velocity.y > 0) { //front_rim = game.add.sprite(148, 182, 'front rim'); //this one if(front_rim==null){ front_rim = game.add.sprite(148, 182, 'front rim'); //patch } ball.body.collides([collisionGroup], hitRim, this); // This can be done in create } Basically everything that has a game.add can be moved to create() in this game. The tweens for example can be paused and played instead of readding them in update. Im not sure why sprites are added in update, you can add them all once during create() and for example toggle their visiblity (emoji.visible=true etc..). I would suggest rebuilding the game from scratch, you will probably have a much better version by going trough the phaser examples. Link to comment Share on other sites More sharing options...
Recommended Posts