In the Game.js file, there is a function that I am working on
Game.prototype.onClick = function(event){
var x = event.x;
var y = event.y;
if (this.blueDeck[0].contains(x, y))
alert("Blue Deck Clicked");
}
The OnClick function is called from a function in the Main.js file
canvas.addEventListener('mouseup', game.onClick, false);
Additionally, there is a function in Card.js
Card.prototype.contains = function(x, y){
return true;
}
Despite setting everything up, the alert message does not appear.
Interestingly, when I remove the if statement in onClick, the alert is triggered. Other functions like
this.blueDeck[0].setDeckPos(w, h);
work perfectly fine in Game.js.
I am puzzled as to why contains is not returning true.