Jump to content

How to update game.time.events.loop


Adko20
 Share

Recommended Posts

Hi guys, I need your help again. So I past here part of my code.

var play_state = {

   create: function() {

      spawnTimerBarrier = 6000;

      this.timerForBarriers = this.game.time.events.loop(spawnTimerBarrier, this.add_row_of_barriers, this);

   },

   update: function() {

      this.update_speed();

   },

   update_speed: function() {

      switch(level){

        case 10: {
           this.game.time.events.remove(this.timerForBarriers);
           spawnTimerBarrier = 2000;
           this.timerForBarriers = this.game.time.events.loop(spawnTimerBarrier, this.add_row_of_barriers, this);
        }
      }
   },
};
 
So It works fine, except this line:  this.timerForBarriers = this.game.time.events.loop(spawnTimerBarrier, this.add_row_of_barriers, this); .... It doesn´t create new events loop with new value of spawnTimerBarrier.
 
PLS help me :( 
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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