Sign in to follow this  

Event for when overlap is finished.

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!

Share this post

Link to post
Share on other sites

I think probably creative use of would be good here:

function update() {  game.physics.arcade.overlap(player, windows, function(player, window) {    window.lastOverlapped = + 100;    window.alpha = 0.5;  });  windows.forEach(function(window) {    if (window.lastOverlapped && > window.lastOverlapped) {      window.alpha = 1;    }  });}

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.