Game maker tutorial: sliding
Uploader Comments (lalabEsjen)
All Comments (14)
-
@rastinder If you're talking about the line between "friction = 0.01" and "if obj_hero.hspeed" then it would be because it looks cleaner and is easier to read. I do it all the time, it separates the blocks of code that don't belong with each other; what belongs is up to you.
-
@grungegames u havent asked why he skipped 3rd line in coding
-
thanks, I like this Video and it helps me a lot to create a better game
-
how did you program your hero's default movement. i mean, how is he going to move when he's not on ice?
-
@lalabEsjen Well, I discussed this somewhere else...so I don't have it, but I can retype it:
hspeed = -4
friction = 0.10
if obj_Player.hspeed = 0
{
hspeed = 0
}
;Player moves at a speed of 1, also I renamed him 'Hero' to see if that would work, but it didn't.
Also I took the liberty of writing vspeed for up and down.
I have 3 questions:
Why do you refer to 'obj_hero' from within obj_hero?
Why would you set the hspeed to 0 if hspeed is already 0?
And why do you put a 0 after the 1 when setting friction?
I'm not trying to be mean I sincerely want to know why.
grungegames 10 months ago
@grungegames First Question answer: It isn't necessary to write Obj_hero.Hspeed, but I did it because it looks better. :) But you would have to refer to the player, if you were writing codes on another objects.
Second Question answer: If I didn't setted the hspeed to 0, would the hspeed continued going down, which means that I would begun to accelrate backwards. Also when the Hspeed reaches 0 after the sliding will the player stop untill you are moving again. Last Question comes at a new comment
lalabEsjen 10 months ago
@grungegames Third Question answered: If you mean this line; "Friction = 0.10", can I explain it easily. I dont really know why I wrote that. actually It isn't necesarry to type 0 after the 1. It is enough to just type in this "Friction = 0.1".
You know; 0.1 = 0.10 = 0.100 = 0.1000 = 0.100000 etc.
lalabEsjen 10 months ago
Yo, it's claiming my object doesn't exist...the name is Player, I write it like 'obj_player' in the execute code and when I touch the ice it gives me a error pop-up.
Please help.
Supertoad25 10 months ago
@Supertoad25 Well I am pretty sure I can help you out, but first you have to show me all the codes that you typed in that's involving sliding. Then will I most likely find whats wrong ;)
When I saying show the codes, I mean that you are duplicating your codes from game maker into a comment as a reply.
lalabEsjen 10 months ago