• 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!

HTML5 [RESOLVED] Object not working

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.
 
T

TesloStep

Guest
in html5 may be problems with sprites stuff, just replace your sprite_height with flat numbers
 
Q

Quinnlan Varcoe

Guest
You could also try replacing the mask after you change the index.

I haven't really experimented with html5 yet but I would assume that could help.
 
T

Triton

Guest
Thanks for your answers ! I tried what you said but it didn't change anything.

I also tried to replaced the 2 mask_index in the step event of the platform by sprite_index and it works.
 
Top