hivernoir Posted July 26, 2014 Share Posted July 26, 2014 Hello Phaser community! I've had a look around for a possible solution and I can't find one. So now I am here to pick your brains for some ideas on how to do it. Basically in my game when my player walks in front of a window, I have the window fade out. When the player is no longer overlapping with the window, I want the window to fade back in. I have it fading out no problem. I am unsure of the best way to fade back in without using a timer. Any ideas?Thanks in advance! Link to comment Share on other sites More sharing options...
lewster32 Posted July 26, 2014 Share Posted July 26, 2014 I think probably creative use of game.time.now would be good here:function update() { game.physics.arcade.overlap(player, windows, function(player, window) { window.lastOverlapped = game.time.now + 100; window.alpha = 0.5; }); windows.forEach(function(window) { if (window.lastOverlapped && game.time.now > window.lastOverlapped) { window.alpha = 1; } });} TNelson 1 Link to comment Share on other sites More sharing options...
hivernoir Posted July 26, 2014 Author Share Posted July 26, 2014 Thank you! It worked a treat. lewster32 1 Link to comment Share on other sites More sharing options...
Recommended Posts