I’m having trouble with Game Development 3, level 7 - Runner Step 1: Environment. This is in Javascript.
My code is:
function onUpdateStatic(event) {
var thing = event.target;
// Each time frame we move a little to the left:
thing.pos.x -= 0.8;
// If thing's X coordinate is less than -4:
if(thing.pos.x < -4){
// If thing's type is "forest":
if(thing.type == "forest"){
// Then set thing.pos.x to 84, so it can re-enter the map from the right side:
thing.pos.y = 84;
}
// Otherwise destroy the thing:
else{
thing.destroy();
}
}
}
I can’t seem to figure out what I’m doing wrong. The game does not produce an error, it just stops as soon as it starts, with an X next to the goal “Move and Reuse Forest Tiles”