Thanks teacher, I found a lot of tutorials explaining ho to do this but they were pretty unrelated and weren't easy to implement, very good explication !
Excellent tutorial! I was wondering if you'd ever make a tutorial on platforms that crumble/destroy after you stand on it for too long, and death pits where if you touch/fall into them it resets the level?
For unknow reason the code didn't work when I wrote it myself (made the exact copy of your), BUT when I just pasted the code from GitHub, it started to work. What kind of magic is this? Anyway, good work!
There's an issue I found with vertical moving platforms with your code, and that is that is that if the player or the platform aren't moving at an integer speed, there's a chance that the subpixel position of the player or platform will make it so the collision won't register at all, making the player fall through it. I haven't found a way to fix this outside of restricting both of them (player's vertical position and the platform's speed) to an integer value, which is obviously less than ideal, and since your GML skills are obviously beyond mine, do you know how to fix this issue?
For those that are looking for answers, you can fix this by rounding `bbox_bottom` in the collision checking selection. this would look like `round(bbox_bottom)
Nice I will have to take a look Thanks. Question do you also plan to make circle based moving platforms and path following platforms in your tutorial series ?
The tutorial is helpful, but the code doesn't work. When I add it to my platform, the begin step code runs perfectly fine, but the end step throws and error for startX, startY, endX, endY and says that "they aren't defined". No idea how to fix this as I'm new to gamemaker. Any solutions?
I got the code right, and so far the platforms were moving but when I did the add velocity section my game keeps crashing saying the issue is both lines of code for velocity
hey Gamemaker i was wondering could you make an "nearly infinite" terrain generation for my 2d topdown survival project cause making width and height 10000 in room is the worst idea ever
@@soulguardian6893 You might be overshooting the collision during the pixel-perfect corrections, check and make sure it's not over-correcting. Use breakpoints!
great tutorial. just one question why did you add "max(1, moveY)" to the instance_place function instead of just "moveY"? it seems a bit unnecessary considering that you already check the boundary boxes in the next line
Sorry matharoo, but I noticed that you cannot rename another instance with the same name ("platform1"), even if it is in two different rooms. So this implies that I have to give a unique name to each instance for each room, correct me if I'm wrong ...
Thanks so much for the simple solution! Would you be willing to elaborate on implementing this in a way where the platforms have collision from all 4 sides (and thus push the player around)? I've been experimenting with the code, but have several challenges with it working as I'd like.
I've been trying to have the character jump down through the platform when pressing down, but I can't seem to get the code to work, any advice? I basically try to make the mask_index = -1, but it doesn't seem to work for some reason. Thanks Matharoo!
When you can (and if you can), can you help me? I keep getting an error even though I did the same thing you did. I tried to start my game at 5:20 in the video. (obj_jumpthroughmovement_collision is the platform moving) Error Code: ___________________________________________ ############################################################################################ ERROR in action number 1 of Step Event1 for object obj_jumpthroughmovement_collision: Variable obj_jumpthroughmovement_collision.endX(100011, -2147483648) not set before reading it. at gml_Object_obj_jumpthroughmovement_collision_Step_1 (line 3) - var _targetX = endX, _targetY = endY; ############################################################################################ gml_Object_obj_jumpthroughmovement_collision_Step_1 (line 3)
I have the same issue - problems seems to be that the moving platform has no local variable for endX,y or startX,Y. It depends on the 2 points to set them, which isn't happening for me either and causes the same crash.
Matharoo, bless you for making these tutorials and hope you keep up making more to teach us :)
Nice one, this is something I was looking for, most tutorials on this are out of date. Thank you!
This is a great tutorial that solved a problem I've had for years. Thank you!
I will adapt the one way jumping to my collision for top ladder blocks, this is awesome, thanks bro.
Thanks teacher, I found a lot of tutorials explaining ho to do this but they were pretty unrelated and weren't easy to implement, very good explication !
Excellent tutorial! I was wondering if you'd ever make a tutorial on platforms that crumble/destroy after you stand on it for too long, and death pits where if you touch/fall into them it resets the level?
For unknow reason the code didn't work when I wrote it myself (made the exact copy of your), BUT when I just pasted the code from GitHub, it started to work. What kind of magic is this?
Anyway, good work!
There's an issue I found with vertical moving platforms with your code, and that is that is that if the player or the platform aren't moving at an integer speed, there's a chance that the subpixel position of the player or platform will make it so the collision won't register at all, making the player fall through it.
I haven't found a way to fix this outside of restricting both of them (player's vertical position and the platform's speed) to an integer value, which is obviously less than ideal, and since your GML skills are obviously beyond mine, do you know how to fix this issue?
Same problem here , I can't se this issue too.
For those that are looking for answers, you can fix this by rounding `bbox_bottom` in the collision checking selection. this would look like `round(bbox_bottom)
@@T4R1N Thanks!!
thanks, simple and easy. perfect.
Great tutorial but I've got one problem. The game is looking for the definition of _movingPlatform, but it can't find it.
Nice I will have to take a look Thanks. Question do you also plan to make circle based moving platforms and path following platforms in your tutorial series ?
Sorry, this tutorial is not part of a series so sadly I won't be expanding on it, at least any time soon.
The tutorial is helpful, but the code doesn't work. When I add it to my platform, the begin step code runs perfectly fine, but the end step throws and error for startX, startY, endX, endY and says that "they aren't defined". No idea how to fix this as I'm new to gamemaker. Any solutions?
replying because I'm having the same problem. My player sprite also sinks through the platform. Are these problems related?
you are the best!
I got the code right, and so far the platforms were moving but when I did the add velocity section my game keeps crashing saying the issue is both lines of code for velocity
same here
Beautiful! Thank you.
or you can use paths for movement
my platform moves nicely but if it hits the start point it doesnt move back, if it hits the ending point it moves back. Help?
i have a problem with this metod. I keep Falling Down When i hit the corners
Thanks for your video!
hey Gamemaker
i was wondering could you make an "nearly infinite" terrain generation for my 2d topdown survival project
cause making width and height 10000 in room is the worst idea ever
I just Got an errormessage and i dont understand it
Why didn't you use: if (alarm[0] == -1) alarm[0] = waitTime; in 4:15 ?
There's no need for it, since the goingToStart boolean is flipped and that statement won't be called again until it reaches another point.
@@GameMakerStation Thanks :)
for the collision with the player with the platform, the player just falls through it and im not sure what the issue is
I have the same issue as you. Did you end up figuring this out?
@@bubbles5195 unfortunately i didn't, unless you get a response then id do a different tutorial
@@soulguardian6893 You might be overshooting the collision during the pixel-perfect corrections, check and make sure it's not over-correcting. Use breakpoints!
@@bubbles5195 Check my other comment in this thread
I have no clue why this doesn't work try 3 times fresh no error code just doesn't let me land nor does it move
Hey there, I see you haven't uploaded anything in a while, is everything alright?
great tutorial. just one question
why did you add "max(1, moveY)" to the instance_place function instead of just "moveY"?
it seems a bit unnecessary considering that you already check the boundary boxes in the next line
That's so it always checks at least 1 pixel down even when moveY is 0 or negative.
Sorry matharoo, but I noticed that you cannot rename another instance with the same name ("platform1"), even if it is in two different rooms.
So this implies that I have to give a unique name to each instance for each room, correct me if I'm wrong ...
Yup! Instance names have to be unique throughout your project.
Thanks so much for the simple solution! Would you be willing to elaborate on implementing this in a way where the platforms have collision from all 4 sides (and thus push the player around)? I've been experimenting with the code, but have several challenges with it working as I'd like.
That sounds like a tough problem. I recommend joining the Discord server given in the desc., you can ask there :)
I've been trying to have the character jump down through the platform when pressing down, but I can't seem to get the code to work, any advice?
I basically try to make the mask_index = -1, but it doesn't seem to work for some reason.
Thanks Matharoo!
just check if key_down && on-the-moving-platform then y += 1 should work
can you please do a tutorial for character movement
Here you go :) ua-cam.com/video/3xaHvRQ2p7Q/v-deo.html
Awesome.
when the platform stops i fall through it
As soon as a platform moves vertically, I fall through the floor
*Write game server*
When you can (and if you can), can you help me? I keep getting an error even though I did the same thing you did. I tried to start my game at 5:20 in the video.
(obj_jumpthroughmovement_collision is the platform moving)
Error Code:
___________________________________________
############################################################################################
ERROR in
action number 1
of Step Event1
for object obj_jumpthroughmovement_collision:
Variable obj_jumpthroughmovement_collision.endX(100011, -2147483648) not set before reading it.
at gml_Object_obj_jumpthroughmovement_collision_Step_1 (line 3) - var _targetX = endX, _targetY = endY;
############################################################################################
gml_Object_obj_jumpthroughmovement_collision_Step_1 (line 3)
I have the same issue - problems seems to be that the moving platform has no local variable for endX,y or startX,Y. It depends on the 2 points to set them, which isn't happening for me either and causes the same crash.
Did you ever figure out how to fix this? I'm having the same issue too.