noah_pl Posted October 31, 2018 Share Posted October 31, 2018 In my game, I want to show on the UI when a power up is unavailable due to a cooldown. I figured the easiest way to do this is to change the button of the power up for the duration of the cooldown. Now I have this working but only for one of the buttons. It seems that the timed event is conflicting with other functions. function sendUnit1(stu_button) { stu_button.frame = 3; game.time.events.add(time, function(){stu_button.frame = 0}, stu_button); } function sendUnit2(fac_button) { fac_button.frame = 3; game.time.events.add(time, function(){fac_button.frame = 1}, fac_button); } This is the code I have without unrelated things surrounding. How can I make the frame update for each button? EDIT: So it turns out that without even worrying about the time event, the button frame won't change in the second function but does for the first function. Why is that? Link to comment Share on other sites More sharing options...
noah_pl Posted November 2, 2018 Author Share Posted November 2, 2018 Just wanted to follow up saying that the solution is to load in a completely new texture rather than change the frame. function sendUnit2(fac_button) { fac_button.loadTexture('cover'); game.time.events.add(cool, function(){fac_button.loadTexture('place_buttons', 1)}, fac_button); } Link to comment Share on other sites More sharing options...
Recommended Posts