Stairs problem: climbing up, and down

I’m trying to make functioning stair, but I can’t seem to make it right. Here’s a screenshot of my event editor:

1 Like

I notice you have simulate pressing down for both going down the stairs and up the stairs. If that doesn’t fix it or there’s still some problems then it will help to describe what does happen in stead of the character going up or down the stairs. And maybe even a screenshot of the stairs so we can see the slope fronts etc.

1 Like

So, I fixed the climb up part


But, I can’t get down after climbing up.
Here’s my screenshot of the stair:

Note: The “slope” is a placeholder for the stair.

I might be the only person here to have never used platforms or jumpthru or that stuff so there will be people here much better able to help you than me. But I notice in the climb up event when the player hits the slope front trigger you change the platform type of Slope to Platform. But when the player hits the down trigger you don’t change it to Platform. So it would remain on Jumpthru the way you have it in the not in collision with Slope event.

And I also think that the experts here might be able to streamline your events, it seems a bit too much to me.

It’s alright, you did your best.

@MrMen, if you see this, can you help?

I assume you want the platform to be just a platform and not a jump-thru one all the time except when you walk through it via the stairs?

If so, you could try duplicating the FloorA object (say call it FloorB). Have FloorA permanently as a platform object, and FloorB always as a jump-thru platform. Then remove a bit of FloorA that’s over the stairs, and replace it with a section of FloorB. This way you won’t have to change the platform type.

I’m not 100% sure it’ll work, but it worth a crack.

I’m not sure if this is exactly what you’re looking for, but maybe it can help. I use the events below for my Ladder, but you could:

  • replace “GroundNormal2”/“GroundNormal3” with “FloorA”
  • replace “LadderTopTrigger” with “SlopeEnd”

My “Player” name is “Ozzy”. I use a timer, but you could also try the new “wait” action. Each of my ground objects has the “jumpthru” behavior added to them.

Basically, it allows the player to climb up through the platform, but then when it tries to go back down the ladder the platform behavior is turned off for half a second to pass through.

laadder

After I follow your instruction, I increased the gravity of the player to make the player “stuck” to the stair because the player’s base gravity make them “fly” when climbing down. How can I make the player or NPC rotate when climbing up/down the stair?

How do you mean rotate? I’m assuming it’s so they are perpendicular to the slope of the stairs.

If the stairs have the same slope every time, then keep track of the NPC’s previous Y position (use and instance variable). If it changes then rotate depending on the way they’re facing and if the change in Y position is an increase or decrease.

I’ve been thinking about this for a bit. For the most “plays well with the platformer behavior” method, and assuming you’re wanting them to act like stairs in Castlevania 1, I’d do the following:

This is all assuming the following:

  1. Your stairs are actually rotated platforms (This example is using a rotated ladder in the default platformer example). if not a rotated platform, instead of -Ladder.Angle() you’ll need to know what angle you want to rotate them.
  2. Your platforms above the stairs are set as jumpthru (this will be required).
  3. You have a separate platformer sprite object and just a separate visual sprite (In the example, Player is the hidden “controller” sprite object. Player2 is the actual visible sprite)
  4. Your stairs are going right. If they’re going left, you’ll need another event for handling flipped sprites/simulating left.

Not sure if this fully helps you out, but here’s the example preview to test it with: https://game-previews.gdevelop-app.com/1655764943218-793756/index.html

Edit: This is pretty close to combining Beanmatt AND MrMen’s suggestions, from what I’ve read. This post has been in my buffer for a few days, sorry about that.

1 Like

I think I want to toss that aside and keep it for later. Though there are some things that bothers me. First of all, press W key while inside the collision box of the “slope” caused the player to be pushed out of the scene due to the “slope” became a platform.