I get the error in the title, but it seems that there is such property? Am I misreading something?
The error
{
bulletBounds: {
x: -36115.46484375,
y: -7557.4404296875,
width: 38.03515625,
height: 38.03369140625,
type: 1
},
playerBounds: {
x: 921.9662475585938,
y: 446.46624755859375,
width: 76.0675048828125,
height: 76.0675048828125,
type: 1
}
} undefined
C:\path\nodejsgame\src\server.js:92
aBox.x + aBox.width > bBox.x &&
^
TypeError: Cannot read properties of undefined (reading 'x')
Code:
function checkCollision(aBox, bBox) {
console.log(aBox, bBox);
return (
aBox.x + aBox.width > bBox.x &&
aBox.x < bBox.x + bBox.width &&
aBox.y + aBox.height > bBox.y &&
aBox.y < bBox.y + bBox.height
);
}