Jump to content

Phaser, seperate logic update from renderer


nuvorm
 Share

Recommended Posts

Hello,

 

I am trying to seperate the logic update from the visual rendering of sprites and came up with this solution.

 

this.counter++;
 
    this.skipFrame=parseInt((60-FPS.fps)/10);
    if(this.skipFrame==0)
    {
        this.skipFrame=1;
    }
 
    if(this.counter % this.skipFrame==0)
    {
        // reset render functions
        this.game.renderer.render=this.f_render;
        this.game.renderer.renderDisplayObject=this.f_renderDisplayObject;
 
    }else{
    
        // clear render functions
        this.game.renderer.render=function(){};
        this.game.renderer.renderDisplayObject=function(){};
 
    }

 

Anyone aware of a better solution?

see attachment for the class FPS.txt

 

 

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

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