J
Jmarlin3
Guest
So the player object is supposed to cross over a floor object, with the floor object switching to a red floor object. If the player object is not touching the red floor object anymore, the red floor object dissapears and turns into a wall object, meaning they can't go back.the
Here's the code:
obj_floor STEP EVENT:
if place_meeting(x,y,obj_player){
instance_create_layer(x,y,4,obj_redfloor);
instance_destroy();
}
obj_redfloor STEP EVENT:
if !place_meeting(x,y,obj_player) {
instance_create_layer(x,y,4,obj_wall);
instance_destroy();
}
When I run the game, the player already has the floor its on gone, I assume because the step event has already started. And when I move to the next floor object, it immeadietly dissapears. I'm trying to make the code work only if the player has interacted with it.
Here's the code:
obj_floor STEP EVENT:
if place_meeting(x,y,obj_player){
instance_create_layer(x,y,4,obj_redfloor);
instance_destroy();
}
obj_redfloor STEP EVENT:
if !place_meeting(x,y,obj_player) {
instance_create_layer(x,y,4,obj_wall);
instance_destroy();
}
When I run the game, the player already has the floor its on gone, I assume because the step event has already started. And when I move to the next floor object, it immeadietly dissapears. I'm trying to make the code work only if the player has interacted with it.