If statement not entered, when I've a console log that says otherwise

https://playcanvas.com/editor/scene/509349
https://playcanvas.com/editor/code/468659?tabs=7320086

The button.js is practically copy/pasted from the Flappy Bird example project. Upon clicking the pink box, it should fire an event, but the code checking for a collision is not working. Even stranger, I’ve set up a console.log that confirms the if statement at line 49 should evaluate as TRUE, but it never is.

I’m just trying this now and it’s never printing ‘YES’ to the console so I’m not sure where you are confirming that this.pressed is true?

That said I have noticed something odd about your bounds check:

    if ((x >= this.min.x) && (x <= this.max.x) && (y >= this.max.y) && (y <= this.min.y)) {

The y is being checked to be above max.y and below min.y where I believe you want:

    if ((x >= this.min.x) && (x <= this.max.x) && (y >= this.min.y) && (y <= this.max.y)) {

Hey! Wow. that’s really embarrassing. Thanks for fixing that for me…