Jump to content

platform speed transition


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

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.

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.


  • Recently Browsing   0 members

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