Jump to content

platform speed transition


Wiked
 Share

Recommended Posts

referencing this https://github.com/fariazz/phaser-infinite-runner source im trying to create a transition that would increase the platform speed.

 

the pre-generatedTerrain updates just fine adding 

this.floors.getAt(i).body.velocity.x = -this.levelSpeed;

 

however the current platforms 'onscreen' are still at the predefined levelSpeed. is there a way I could update all of these at once. ?

 

---------------------------------------

 

my solution was not to even set levelSpeed at the generation of the terrain, but to set it on the current floor 'onscreen'.

 

    	if (this.myCoins >= 5){
            this.levelSpeed = 350;
            
            for(var f = 0; f < this.floors.length; f++){
                this.floors.getAt(f).body.velocity.x = -this.levelSpeed;
            }

            for(var c = 0; c < this.coins.length; c++){
                this.coins.getAt(c).body.velocity.x = -this.levelSpeed;
            } 
        
	   }

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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