Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

On frame update callback


Malyuga
 Share

Recommended Posts

 

 

Hi, I did not read the forum, so if the answer to my question already exists, then please excuse me. I would like to know how I can call a callback for a specific frame. On the Phaser 3 Example page, I see a callback just for the whole animation, thanks!

var animConfig = { 
    key: 'diamond', 
    frames: this.anims.generateFrameNames ('gems', {prefix: 'diamond_', end: 15, zeroPad: 4}), 
    repeat: 3, 
    onUpdate: animUpdateCallback 
};

function animUpdateCallback (sprite, animation) 
{ 
    sprite.x + = Phaser.Math.Between (-4, 4); 
    sprite.y + = Phaser.Math.Between (-4, 4); 
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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