Something I’ve been wondering about. Might be more obvious than I realize, it just seems to be one of those apparently straightforward things that rapidly run out of control and cause confusion when you really try to work them out.
In some platformers, you can jump and grab onto platform ledges and then lift your character up onto the ledge, usually by pressing jump again. What I have in mind here mostly is Flashback, with the system I’m talking about illustrated many times in this video here:
Ok, on some level that seems simple enough, I just can’t quite get my head around the exact mechanics.
How would you implement something like that?
I figure the rough outline of what’s happening could be described as:
- Player jumps toward grabbable (not a word… yet) ledge.
- The ledge is detected by whatever means and the player position snaps to that ledge.
- We are now in “ledge-grab mode” in some way, with all the changes in physics and controls that might involve.
- In this mode, pressing down might make us fall, and pressing jump might make us climb
- Climbing causes the player’s position to gradually move to some point on top of the platform, roughly above where they were while grabbing.
I have a few practical problems with this though.
- When grabbing the ledge, where should be player be positioned? Say if you had a 16x32 player sprite, you couldn’t simply place the player at ( [Ledge X Position] - [Player Width]), because then it would odd graphically when the player’s hands were clearly not overlapping the ledge and grabbing on. Flashback definitely seems to have the player overlap the platform in some way.
Another factor is when climbing up, the player obviously has to end up directly above solid platform, which again implies that overlapping the solid platform makes sense. - How should climbing up work? It needs to accommodate both a climbing animation that makes sense and the logic of standing on a platform. Perhaps position the player’s centre directly on the edge of the platform, so the player graphic (if we’re using standard sized sprites all of the time like 16x32 and not allowing it to go bigger sometimes) can probably look right for hanging and climbing? Then do we just make the player move upward while animating until reaching a certain point and drop onto the solid surface and continue as normal, or should the player’s position actually follow some kind of more complex path while climbing? Such as upwards… then towards the ledge?
Maybe I’m overthinking this, but I’ve found it a bit hard to come up with a really satisfactory answer that didn’t seem to leave something out.