• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Visual help a beginner, Fire Jump Game

majornara

Member
I was following the tutorial and I came across this error and I don't know what to do.
meu erro.PNG

As I was programming following the tutorial on the website, the programming is like this

meu codigo.PNG

This is my first attempt at game maker, I really wanted to make it work
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, so GameMaker is telling you that you are using a variable which hasn't been declared yet, and so doesn't actually exist. In this case it's saying that the variable Background is being used by the obj_Player when calling the function layer_get_y(), but it hasn't been defined with any value yet. Great! Now you know what the issue actually is but how to solve it? Have a look at the manual for the function layer_get_y():
Check what the text says about the input parameter for the layer: "You supply the layer ID (which you get when you create the layer using layer_create()) or the layer name (as a string)"
So, the issue here is that you are using the layer name to target without telling GameMaker it's string, so it thinks that Background is a variable when it should actually be "Background", a string.

I hope that helps! :)
 
Top