Legacy GM Platform code for upside down room

B

Bolt3dge

Guest
I used the platform code that Shawn Spradling showed on his youtube channel. I want to have a room that make your player jump upside down so the gravity and jumping will go up instead of down. Here is the code I use for regular platform code, but I can't figure out what to change.
Code:
///React to input
if room==room0 or room==room3
{

if keyboard_check(ord('D'))
vsp=20
//key_left = -keyboard_check(ord('A'));
key_jump = keyboard_check_pressed(vk_space);
//attack = mouse_check_button_pressed(mb_left)
//moving
//x += global.movespeed;
move = 1;//key_left + key_right;
//Jumping
hsp = move * global.movespeed * movefactor;

if (vsp < 12) vsp += grav;

if (place_meeting(x,y+1,obj_block))
{
  vsp = key_jump * -global.jumpspeed;
}
//Collisions Horizontal
  if (place_meeting(x+hsp,y,obj_block))   
{
    while(!place_meeting(x+sign(hsp),y,obj_block))
    {
        x += sign(hsp);
    }
     hsp = 0;
 }
 x += hsp;
 //Verticle collisions
 if (place_meeting(x,y+vsp,obj_block))
{
    while(!place_meeting(x,y+sign(vsp),obj_block))
    {
        y += sign(vsp);
    }
  vsp = 0;
  }
 y += vsp;
 }
 

NightFrost

Member
You'd flip gravity, jumpspeed and ground collision detection that gates the jump action. Personally I'd do with changing variables, but the code changes would be:
Code:
// Replace these lines:
if (vsp < 12) vsp += grav;
if (place_meeting(x,y+1,obj_block))
{
  vsp = key_jump * -global.jumpspeed;
}

// With these:
if (vsp > -12) vsp -= grav;
if (place_meeting(x,y-1,obj_block))
{
  vsp = key_jump * global.jumpspeed;
}
I'm not sure what the idea is with:
Code:
if keyboard_check(ord('D'))
vsp=20
Or "when moving right, set vertical speed to 20."
 
Top