• 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!

Windows help for a beginner

L

LTZZ

Guest
I'm starting to learn to make games now and I'm having this problem, I can't solve it for anything
could you help me please?

ps: sorry if i made the post in the wrong place and sorry the google translator.:)



imagem_2021-04-14_054944.pngcap1.PNG
 

NightFrost

Member
Perhaps YYG should have called 2.3 update the 3.0 update so it would be more obvious that many tutorials will become outdated. :)
 

nicognito

Member
Hi, LTZZ

Not sure if it can help you (I'm still a newbie at GML):
  • I think on line 24, you should use x + sign(hsp) instead of just x + hsp, because I guess you want to move your object 1 pixel at a time until you collide with your wall (which you know is within hsp distance, according to line 23).
  • I might be wrong, but it seems you're running your code inside a Create event, according to the error message. I don't know if we're allowed to use the collision functions in Create event (I wish I could verify it now but I'm not home at the moment ... office work... 😅). Instead, maybe run your code in the Step event and just do some initializations in the Create event.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I might be wrong, but it seems you're running your code inside a Create event, according to the error message. I don't know if we're allowed to use the collision functions in Create event (I wish I could verify it now but I'm not home at the moment ... office work... 😅). Instead, maybe run your code in the Step event and just do some initializations in the Create event.
That's what it seems like at a first glance. What's actually happening is that OP is attempting to read y, a default instance variable, in a script. That is, directly in a script, without wrapping it in a function. Scripts run at a global scope, and the global scope doesn't have a y variable, so that's a one-way trip to spontaneous combustion land.

The global scope neither has an associated object nor an associated event, so the error message describes it as "Create event for object <undefined>". The English translation of this highly sophisticated technical term that can only be understood by arcane wizards is "script". Why does it mean script? Hell if I know. Probably because there's no error message for this specific issue, so the error dialogue is like "what the hell man this makes no sense" and just spits out whatever unfortunately worded mess it can come up with. :p Take a look at the topic I linked earlier for a more in-depth explanation of the issue.

@LTZZ
Feel free to file a bug report to have this message replaced with something more descriptive (it already says it's in a script further down, but people tend to get thrown into a panic after "Create event for object <undefined>" and don't read the rest).
 
Top