Game Maker Studio: How to Move on Steps & Slopes?
Visit my MColver Art Gallery site: https://mcolverartgallery.wixsite.com/gallery
Paypal Donate: http://bit.do/fkPAb
GMS File: https://bit.ly/3dQQwS3
Steps & Slopes: This Guy Explains it better then me...
https://www.youtube.com/watch?v=Pen8djqS2JQ
Note: Be sure to parent obj_player_left with obj_player_right.
obj_player_right, ///center both player and modify mask to Ellipse
Events:
Create
Actions:
///movement variables
m_speed = 10;
m_step = 5;
vspeed = 0;
m_gravity = 1
m_jump = -15;
Events:
End Step
Actions:
////movements
vspeed += m_gravity;
if keyboard_check(vk_left)
{
move_contact_solid(90, m_step);
move_contact_solid(180, m_step);
move_contact_solid(270, m_step);
}
if keyboard_check(vk_right)
{
move_contact_solid(90, m_step);
move_contact_solid(0, m_step);
move_contact_solid(270, m_step);
}
if keyboard_check_pressed(vk_up)
if !place_free(x,y+1)
{
vspeed = m_jump;
}
Events:
Collision with obj_block, check solid ///Check solid for slopes too.
Actions:
vspeed = 0;
move_contact_solid(270,12);
Events:
Collision with obj_right_slope
Actions:
vspeed = 0;
move_contact_solid(270,20); ////its 20 because, I'm trying to take out the little jumps he does, when he moves down the slope. Its a little glitch that you may or may not see. May need to adjust 20 to like 30 or maybe less, to have less small jumps going down slope.
Events:
Collision with obj_left_slope
Actions:
vspeed = 0;
move_contact_solid(270,20);