J
Jmarlin3
Guest
The idea is that when the player is touching the floor, it turns red. However, when there are multiple floors, so if the player isn't touching it, I will go away.
Code for floor: Step Event
Code for redfloor: Step Event
Code for player: Create
Step Event:
Is there something I can do to where it doesn't go away until after the player has touched it? I didn't want to do a timer.
Thank you for the help.
Code for floor: Step Event
Code:
if !place_meeting(x,y,obj_player){
instance_create_layer(x,y,4,obj_redfloor);
instance_destroy();
}
Code:
if !place_meeting(x,y,obj_player)
{
instance_create_layer(x,y,4,obj_wall)
instance_destroy();
}
Code:
spd = 4;
Code:
move_up = keyboard_check(vk_up);
move_down = keyboard_check(vk_down);
move_left = keyboard_check(vk_left);
move_right = keyboard_check(vk_right);
xx = move_right - move_left;
yy = move_down - move_up;
hspd = xx*spd;
vspd = yy*spd;
if(place_meeting(x+hspd,y,obj_wall)){
while(!place_meeting(x+sign(hspd),y,obj_wall)){
x+= sign(hspd);
}
hspd = 0;
}
x += hspd;
if(place_meeting(x,y+vspd,obj_wall)){
while(!place_meeting(x,y+sign(vspd),obj_wall)){
y+=sign(vspd);
}
vspd = 0;
}
y += vspd;
Is there something I can do to where it doesn't go away until after the player has touched it? I didn't want to do a timer.
Thank you for the help.