Jump to content

make switching color visible to user


oxxxo
 Share

Recommended Posts

I am trying to change the color of the sprite using tint, however after certain milliseconds the color will go back to its original color,

My goal is just to let the user know that there is a color change at some moment.

var button = this.add.sprite(10, 750, this.drawButtons(0, 0, 160, 160, 20, "yellow" )); button.inputEnabled = true;function returnColor(){      button.tint = 0xffff33;}function changeColor () {      button.tint = 0xff0000;      this.time.events.add(50, this.check, this).autoDestroy = true;;       }function update() {      this.button.events.onInputDown.addOnce(changeColor, this);}

the timer actually works, however the longer you are on the game the longer the color change responds.. it seems like the timer event is adding up the time..

 

what is  the right way to implement this?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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