T
Triton
Guest
Hello,
I made one-way platforms using this tutorial :
It works perfectly in Windows mode, but not in HTML5 (I tried with Chrome and Edge).
The player can't stay on the platform and automatically fall.
This is the code in the one way platform :
Create :
sprite_index = -1;
Step :
if round(obj_player.y+obj_player.sprite_height/2) > y+1 || obj_player.key_down
mask_index = -1;
else
mask_index = spr_mur_ow;
Draw:
draw_sprite(spr_platform,0,x,y);
And this is the code is the step event of the player that check if there is a wall :
//horizontal collision
if place_meeting(x+horizontal_speed,y,obj_wall)
{
while(!place_meeting(x+sign(horizontal_speed),y,obj_wall))
x+=sign(horizontal_speed);
horizontal_speed = 0;
}
//vertical collision
if place_meeting(x,y+vertical_speed,obj_wall)
{
while(!place_meeting(x,y+sign(vertical_speed),obj_wall))
y+=sign(vertical_speed);
vertical_speed = 0;
}
I don't think the problem comes from the player object because it works perfectly with normal walls.
I made one-way platforms using this tutorial :
It works perfectly in Windows mode, but not in HTML5 (I tried with Chrome and Edge).
The player can't stay on the platform and automatically fall.
This is the code in the one way platform :
Create :
sprite_index = -1;
Step :
if round(obj_player.y+obj_player.sprite_height/2) > y+1 || obj_player.key_down
mask_index = -1;
else
mask_index = spr_mur_ow;
Draw:
draw_sprite(spr_platform,0,x,y);
And this is the code is the step event of the player that check if there is a wall :
//horizontal collision
if place_meeting(x+horizontal_speed,y,obj_wall)
{
while(!place_meeting(x+sign(horizontal_speed),y,obj_wall))
x+=sign(horizontal_speed);
horizontal_speed = 0;
}
//vertical collision
if place_meeting(x,y+vertical_speed,obj_wall)
{
while(!place_meeting(x,y+sign(vertical_speed),obj_wall))
y+=sign(vertical_speed);
vertical_speed = 0;
}
I don't think the problem comes from the player object because it works perfectly with normal walls.