• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Platformer simple question on Y drop down.

Laura Bravo

Member
This should be simple but I can't seem to find the error. I even when and did a tutorial and simplified the code and am getting the same issue. Basically, if I walk off a ledge and hit the end just right, it teleports to the block below (moves in 1 frame). It has to hit the edge just right seeming as right on the ledge but this happens often if it does not hit just right the player object walks off and falls normally. The player uses a mask that is a rectangle so no rounded parts and the collision object are just square boxes so again no rounded parts, and the Y detection and movement happen together and AFTER any B movement so there should not be any reason the player object detects a floor, moves forward, and goes to the floor below.

GML:
if( device_mouse_check_button_pressed(0, mb_any) = true )
        {
        joy_x = device_mouse_x_to_gui(0);   
        joy_y = device_mouse_y_to_gui(0);   
        }
    
    if( device_mouse_check_button(0, mb_any) = true )
        {
        temp_d = point_direction(joy_x,joy_y,device_mouse_x_to_gui(0),device_mouse_y_to_gui(0));
        if( temp_d > 110 ) && ( temp_d < 250 )    { direction=180;    move = -1;    face = -1;}        //Heading Right
        if( temp_d > 290 ) || ( temp_d < 70 )    { direction=0;        move = 1;    face = 1;}            //Heading Left
        if( temp_d > 70 ) && ( temp_d < 110 )    { move = 0;}                        //Upwards
        if( temp_d > 250) && ( temp_d < 290 )    { move = 0;}                        //Downwards
        }   
if ( mouse_check_button(mb_any) = false )
    {    move = 0;    }
    
if ( place_meeting(x+move*move_s, y, obj_block_solid) )   
    {   
    while ( !place_meeting(x+move, y, obj_block_solid) )
        {    x += move;    }
    move = 0;
    }
    x += move*move_s;
    
grav_force += 1;

if( keyboard_check_pressed(ord("X")) = true ) //&& ( place_meeting(x, y+1, obj_block_solid) )
    {
    grav_force = -jump_force;   
    }
    
if ( place_meeting(x, y+grav_force, obj_block_solid) )   
    {   
    while ( !place_meeting(x+move, y+sign(grav_force), obj_block_solid) )
        {    y += sign(grav_force);    }
    grav_force = 0;
    }

y += grav_force;
Also since each step that the player is on a solid block the grav_force is set to 0 so there should be no build up of grave_force to cause the rapid drop, nor does said drop happen unless the player object hit the ledge edge right on the line.
Please help if you know whats going wrong. Thanks.
 

Laura Bravo

Member
Thank you, I honestly have no idea how I missed it. I guess sometimes it just takes another set of eyes to see the obvious.
 
Top