Download

Ledge climbing implementation approach question

I’m sure this is a relatively easy question for those more experienced, so I wanted to ask before I got too deep into implementing the mechanic. Apologies in advance for the wall of text:

Currently, I have a combo system that, while doing a combo, a boolean value prevents the character from moving in any direction or jumping. As I advanced, I began to debate making an enum for tracking the character’s movement restrictions, e.g. “FullBodyAnim” or “NoMovement” for when movement shouldn’t be allowed, “UpperBlend” or “RestrictMovement” for when movement is allowed but some animations shouldn’t be played, etc. This also might be a flawed idea, but I haven’t gotten into it, so also feel free to call me out on this.

Now, I’m implementing ledge climbing. From a ledge, players are allowed climb onto, jump straight up from, jump away from, or drop from the ledge. Depending on the ledge, some of these actions may also be restricted. So, my question is this: should I continue using bools, though it feels like it might get cluttered, move to using an enum, like above, except containing player character statuses to control movement (“InCombo”, “Reloading”, “OnLedge”, etc), or try to figure out movement modes? I say “figure out” because I still don’t quite understand them or how to go about implementing them. I’m also not clear on use cases, aside from when the player’s physics need to be altered…?

Anyway, any advice would be appreciated.

Come on guys, even a simple “I did (something similar) using (xy method)” would be helpful.
Is using a bunch of bool values to control input to this degree bad programming?
Would a status enum of some sort be confusing?
Is making a new movement mode overkill?

From how you describe your system I would implement it where the ledge object returns a type. Based on this type the character can do X number of actions.

That’s actually similar to how I currently do it:
The game is a platformer, so I don’t need any smart ledge sensing. Therefore, I opted to make an “interactable object” system that the ledge system makes use of. The ledge interactable object contains information like that. Up to the point of getting the character on the ledge is pretty straight-forward, from there. Where I’d like some advice is what method to use to limit those actions after the player is attached.

Just setting it up with booleans isn’t difficult at all, I’m just starting to be concerned that I’ll have this gross mass of bools as I introduce these different “modes”/“character statuses”, like the combo or ledge mode/statuses mentioned. At this point, I’ve gotten almost no feedback, so I’ll probably just go ahead with bools and refactor, later, to an enum when I have a clearer idea of what the enum needs to be able to handle.

Anyway, thanks for the comment. Talking this out always helps me think.

You are welcome. But as an advice, if you already know you are getting multiple types, I would go for enum now, saving the effort the need for refactor. It’s a quick win. You probably have more urgent things to refactor.