Recommended Posts

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!

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
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 samid737I appreciate your reply. I saw your snippet from the other post. Do I have to remove adding a sprite from the update?

Share this post


Link to post
Share on other sites

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.

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.