# 2D Stairs

This topic is 4691 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Anyone played one of the latter level by level Castlevanias (Castlevania 4, Dracula X)? How could I implement a stair system like that? Ive tried a few things but nothing is getting acceptable results.

##### Share on other sites
I assume you mean, like when you press up at the foot of a stair case you go up? I assume the just have a flag in the tile that identifies it as 'the foot of a staircase'. If the user is on it, and presses up, they go up.

What have you tried so far? What isn't working?

Matt Hughson

##### Share on other sites
Well the main problem Ive had so far is not with the starting to climb the stairs but when landing into them after a jump. Ideally, the player would latch onto the stairs at the same spot on the x axis corresponding to the stair they are colliding with if they are pressing up.The problem is that the point of collision will change and hence the coordinates wont always correspond.

##### Share on other sites
Not that I think it's an ideal solution, but didn't Castlevania just let you fall right through the stairs when jumping onto them? Maybe they fixed that by the SNES version though, not sure.

Matt Hughson

##### Share on other sites
I've never played Castlevania so I'm not sure on the specific stair-case you're referring to, so I'll try to explain as best I can.

If you're using a 2D engine you could create another sprite set of your character(s) climbing a stair-case, and get those sprites to be used when you hit a certain block set to a "stair-case" type. E.G.:
while ( map.block[1] == staircase ){    LoadSprites(player_climb.bmp);    UseSprites(player_climb.bmp);}

That's a very basic example, assuming you've defined everything where needed.

##### Share on other sites
Never mind guys, I dont think I explained myself too well. Nevertheless, I'm pretty sure I thought up a decent solution to my problem.

##### Share on other sites

In Castlevania: Symphony of the Night the collision is tested against a slope and the stairs are simply a graphical affectation (you can see this if you use a cheat to enter the test screen). The stair graphic protrudes above the collision slope, obscuring the characters feet, thus hiding the fact that he is not standing on any particular stair. Perhaps if you used a similar system your problem would become less complex.

##### Share on other sites
Define a line that indicates the walkable portion of the stairs. Then if the character's feet intersect that line while up is pressed then the character is on the stairs. That should work for both jumping, walking, or falling.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 16
• ### Forum Statistics

• Total Topics
632155
• Total Posts
3004484

×