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

GameMaker When adding to X value what is the measurement used?

S

Snayff

Guest
Evening all,

I am sure this is super simple but a google and review of the help docs didn't provide the answer. When I move the player by incrementing the player objects X value (say by a value of 5) what is that number a measurement of? Is it pixels or some other unit?

I ask because rather than guessing wildly I want my movement information to be a % of a standard tile size.

Any help would be appreciated!

-Snayff
 
S

Snayff

Guest
I didn't know about those methods, thank you for sharing them.
 

TheouAegis

Member
Really? I mean, it is kind of algebra-level, I think. I dunno, I haven't taken algebra in 18 years. It's also covered in rudimentary physics.

F(x) = a * b/c

Distance Traveled = Time * Rate Of Travel

The Time is 1 step, so we can ignore that.

So if your rate of travel is, say, 5% of a tile width per step and your tiles are 32 pixels wide each, then your rate of travel will be 32 * 5/100, or 32/20, or 8/5.
 
S

Snayff

Guest
Thank you for breaking it down so clearly buddy.

I hope I don't sound ungrateful but I might have been unclear in my initial question; I wasn't sure what the "1" meant in relation to the game world in "player object.x + 1" . If it is a pixel then I can work out the % movement.

Though at the risk of sounding silly, as you mention time increments is that step/room_speed ?
 

TheouAegis

Member
The only time you should worry about reading room_speed really is for calculating seconds roughly.

n seconds = n * room_speed

But your dilemma sounds like time increments are no concern here.
 
Top