Switching between stairs and floor?

So my game is going to have a big part of the story taking place in a house. And since the game is fully 2D, there are going to be stairs that go through the floor.

I need the player to be able to walk fully on a floor, and past the stairs, but also walk up, and down the stairs whenever they want.

There is another issue in terms of stairs. Basically there is going to be at least one staircase, which is facing towards the camera, meaning it will act more as a ladder than a staircase, but I still want the player to interact with it as if it was a staircase.

What I mean by that, is for example, I don’t want the player to be able to walk higher than the floor level, and then walk off the stairs and drop down. I want the player to never leave the ground. As the game will also not have jumping.

So I want the player to stop once they reach a floor on those front facing stairs, and then if they want to keep going up, they can press the same button again, but they won’t be able to walk off the stairs until they are level with a floor.

Anyone know how I would do these?

You could put a trigger near the stairs. Then when the player pushes a button near them their hitbox is temporarily disabled as they linearly interpolate to the other end of the stairs.

1 Like

Do you mean snes castlevania style?

Yes, exactly like that.

Totally untested, but put a trigger at the very bottom and very top of the stairs, when you press “up” it sets a “ascending” value and switches collision. When you “exit” the bottom or top trigger, it stays set until you “enter” the trigger again, check for which way you entered or left the trigger to determine whether you’re still on the stairs, or you’ve walked away from them.

1 Like