Does anyone know how to fix this? (Program Error: Cannot read properties of undefined (reading 'fields'))

When i die i keep getting this error, does anyone know how to fix this?

it’s located in the script that generates the world. (the generate function)

3 Likes

The issue is that the “game over” stops the forever block from restarting after it’s done, but it doesn’t stop it from completing the code it’s running, so you die and the Wait block is still running in the Forever block, and then the Wait block stops running and it runs the function, but now after the game is over the sprites and the tilemap don’t exist anymore, so trying to do things with them causes an error.
The simple solution is to put the Wait block after the Generate function block, like this:

1 Like

thanks!

4 Likes

Hey this is a pretty cool game! Is it suppost to be like Subway surfers or something of the sort? If it was I’m pretty sure I might now how to add a running character in front of the camera. Either way looks pretty good so far :ok_hand:

3 Likes

thanks! it is based on this game: https://www.crazygames.com/game/snow-rider-3d

2 Likes