• 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 Why is there a need for redefinition of basic variables?

L

Lyric8925

Guest
for example, why we need to replace "hspeed","vspeed" to custom var like "hsp" and "vsp" ?
i can't imagine the disadvantage of using hspeed directly...
 

Coded Games

Member
The built in hspeed and vspeed will always move your objects. That is fine if that is what you want to happen. But for example if you want to implement delta timing you cannot use those variables. A lot of built in variables are fine for beginner use but when you start making more complex projects their “features” become problems. So most tutorials will have to use custom variables instead to avoid unexpected behavior.
 
L

Lyric8925

Guest
Do you like being able to control how x and y change from one step to the next? If you use the movement built-ins, you're ceding that control to the program.
The built-in variables are not just (hv)speed, but also x and y...
 
L

Lyric8925

Guest
The built in hspeed and vspeed will always move your objects. That is fine if that is what you want to happen. But for example if you want to implement delta timing you cannot use those variables. A lot of built in variables are fine for beginner use but when you start making more complex projects their “features” become problems. So most tutorials will have to use custom variables instead to avoid unexpected behavior.
Well, although I'm still confused now, maybe I'll understand it later when meet these problems
 

TsukaYuriko

☄️
Forum Staff
Moderator
Setting hspeed and vspeed sets gears in motion that update an instance's x and y automatically every step, with you having no control over this behavior.

Using x and y doesn't set any such gears in motion, therefore you are not giving up any control.
 
L

Lyric8925

Guest
Setting hspeed and vspeed sets gears in motion that update an instance's x and y automatically every step, with you having no control over this behavior.

Using x and y doesn't set any such gears in motion, therefore you are not giving up any control.
Oh, thank you. I understand now.
In fact, I seem to have run into this problem already, when dealing with collisions
 
Top