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.
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.
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;
Please help if you know whats going wrong. Thanks.