Jump to content

Event for when overlap is finished.


hivernoir
 Share

Recommended Posts

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

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;    }  });}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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