Cannot Read Properties of Undefined Variable
I don't even know I've seen some weird errors but this one is just persistent.
let player;
init = function() {
player = {
x: 0,
y: 0,
zoom: 2
}
}
update = function() {
updateEm();
}
draw = function() {
screen.clear();
resetHighlighted();
drawEm(player);
drawHexagon(80+player.x,80+player.y,120);
}
I'm getting an error on line 19 ( drawHexagon(80+player.x,80+player.y,120);
).
Cannot read properties of undefined (reading 'x'), in file "main" at line 19
Whenever I update my code, the error changes to a line in any file seemingly randomly; some lines don't even mention an x variable. I really just can't understand why I'm getting this error, so if anyone has any insight, that'd be greatly appreciated! If you need more of my code I can also try to provide that.