2D Stairs

Started by
6 comments, last by TechnoGoth 18 years, 6 months ago
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.
Advertisement
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
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
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.
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
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
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.
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.

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.
Geocyte Has Committed Suicide.
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.

This topic is closed to new replies.

Advertisement