I have added some code to the player so that you can increase/decrease your max speed from 0 to 12 by clicking the left/right mouse buttons.
I have made some ramps and placed blocks next to them. At a slow speed the player can go up and down the ramps and continue along the blocks fine.
However when the player goes up the ramp in a faster speed, the player will collide/bump with the next block and stop, before continuing again.
The work around I found to stop the collision/bump, was to increase the z_step.
" if instance_place(x,y,o_ramp_LR) or instance_place(x,y,o_ramp_RL){ position.z_step = 16;}else{position.z_step = 4;} " without posting a video or the full code/project here.
You might want to make z step equal to the absolute value of speed + 1 (speed on x/y axis only). Then, the further (i.e. faster) you step into the slope, the higher the step the player can take. Keep in mind that this could allow the player to climb on anything if their speed exceeds the height of the object.
Thank you for your reply.
I have created a hierarchy o_blocks_parent with, o_blocks and o_ramps as the children. And updated all the collision code with o_blocks_parent. And cleaned up my previous code in the above comment with; if instance_place(x,y,o_ramps){ position.z_step = 4 + abs(speed+1)}else{position.z_step = 4} this way i cant "climb" on anything and it works buttery smooth.
I am unable to do most paid work since I don't have a lot of time to get involved in projects that will require copious amounts of development. My work as an Embedded Systems Programmer is a demanding task, so this is more of a hobby for me at this point.
← Return to asset pack
Comments
Log in with itch.io to leave a comment.
Thank you very much for this tutorial series!!!
I have added some code to the player so that you can increase/decrease your max speed from 0 to 12 by clicking the left/right mouse buttons.
I have made some ramps and placed blocks next to them. At a slow speed the player can go up and down the ramps and continue along the blocks fine.
However when the player goes up the ramp in a faster speed, the player will collide/bump with the next block and stop, before continuing again. The work around I found to stop the collision/bump, was to increase the z_step.
"
if instance_place(x,y,o_ramp_LR) or instance_place(x,y,o_ramp_RL){
position.z_step = 16;}else{position.z_step = 4;}
"
without posting a video or the full code/project here.
Is this correct?
You might want to make z step equal to the absolute value of speed + 1 (speed on x/y axis only). Then, the further (i.e. faster) you step into the slope, the higher the step the player can take. Keep in mind that this could allow the player to climb on anything if their speed exceeds the height of the object.
Thank you for your reply.
I have created a hierarchy o_blocks_parent with, o_blocks and o_ramps as the children. And updated all the collision code with o_blocks_parent. And cleaned up my previous code in the above comment with; if instance_place(x,y,o_ramps){ position.z_step = 4 + abs(speed+1)}else{position.z_step = 4} this way i cant "climb" on anything and it works buttery smooth.
You will be named in the credits.
I just donated $15 to this project. Between 1-4, slopes and the water I’ve been trying to figure this out for a year.
at this point I could probably add stuff like ladders and wall jumps, myself, but ideas to add for version 5
Thanks, I appreciate it. When I have some time I will add tutorial #5.
This is really awesome stuff. Do you ever do paid work in gml?
I am unable to do most paid work since I don't have a lot of time to get involved in projects that will require copious amounts of development. My work as an Embedded Systems Programmer is a demanding task, so this is more of a hobby for me at this point.