xNYARLx
Member
Hello
It's me again
I would like to make collisions on the GRID I am moving on, but only at the top. Left, right and down no. I did, but I can't move up and down on it at all. Someone help?
It's me again
I would like to make collisions on the GRID I am moving on, but only at the top. Left, right and down no. I did, but I can't move up and down on it at all. Someone help?
GML:
// CLIMB/GRID COLLISION
var _collision = instance_place(x, y, obj_par_climb)
if !(_collision == noone)
{
// grab the grid
if (global.input_key_shift_pressed)
{
p_state = player_state.climb;
}
// move while on grid
if (p_state == player_state.climb)
{
// prevent from jumping
jump_count = 1; //0 to one jump from grid, 1 to 2 jumps (multi jump)
grav = 0;
jump_speed = 0;
player_walk_running = false;
move_speed = move_speed_default;
y = _collision.y + _collision.sprite_height; //THERE IS COLLISION
// player stop and fire
if !(player_can_stopandfire)
{
move_speed = move_speed_grid;
hsp = input_h * move_speed;
vsp = input_v * move_speed;
}
else
{
move_speed = approach(move_speed, 0, move_speed_friction_default);
vsp = approach(vsp, 0, move_speed_friction_default);
}
// leave grid [z pressed]
if (global.input_key_z_pressed)
{
vsp = -5;
grav = grav_default;
jump_speed = jump_speed_default;
move_speed = move_speed_default;
p_state = player_state.idle;
}
}
player_can_bounce = true;
}
else
{
// reset to default
if (p_state == player_state.climb)
{
p_state = player_state.walk;
grav = grav_default;
jump_speed = jump_speed_default;
move_speed = move_speed_default;
}
}