Hello I'm making a game for my CS class using JavaScript. I know how to ale objects collide with each other in the canvas but I m trying to get an object to detect if it's completely inside another object
If (object1.xcoord > object2.xcoord
&& object1.xcoord + object1.width < object2.xcoord + object2.width
&& object1.ycoord + object1.height < object2.ycoord +object2.height) {
alert("hi")
}
Note I only need those three sides it doesn't matter to me if object 1 is within top side of object 2
Also is it possible to only use comparisons like < or > and not anything else