Jump to content

Change animation frameRate dynamically


darkraziel
 Share

Recommended Posts

Hi all, I have a simple question about phaser animations. Right now I'm working in a game where I animate some spheres that roll down a road. The animation frameRate depends on the sphere "speed", so if the spheres go faster the animation will move faster too and so on.

 

I'm currently changing each sphere frame manually on the update method. To do this each sprite has an array with the frameNames.

for (i = 0; i < 80; i++){        this.redOrbFrames.push('orb_red_' + i +'.png');        this.greenOrbFrames.push('orb_green_' + i +'.png');        this.blueOrbFrames.push('orb_blue_' + i +'.png');        this.goldOrbFrames.push('orb_gold_' + i +'.png');        this.purpleOrbFrames.push('orb_purple_' + i +'.png');        this.calypsoOrbFrames.push('orb_calypso_' + i +'.png');        this.blackOrbFrames.push('orb_black_' + i +'.png');}sphere.orbFrameNames = this.redOrbFrames.update(){   i++;   this.frameName = this.orbFrameNames[i];}

Something like that.

 

I wanted to know if there's another way to do something like this by using phaser animations and if it would be more efficient performance-wise.

 

Excuse the poor english and thanks for any help provided.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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