- Home /
Inheritance based state machine for controls?
Basically, I saw this YouTube video https://www.youtube.com/watch?v=I0sbUsQruIs and this guy set up his whole player movement system so that it is a state machine based on inheritance. He has different movement states, like walking, jumping, falling, and stuff like that.
When I first saw this video I was like "OMG this is so nice because he can just create a new state that inherits from the base state and just make modifications and new methods for the new states to make them unique." I was really excited to use this method of movement, but now I'm starting to think about it more. I remember people always telling me that inheritance is bad for games, and that it can get you stuck. This is kind of scaring me away from this guy's way of setting up his player movement because he uses inheritance. I really liked his method but now i'm scared to use it.
So is inheritance alright to use in this case or do you think that it can get me stuck in the future? I am creating my first big game and I am trying to make my code as sustainable as possible because this project will probably be big and I may even be working on it for a few years.
Your answer
Follow this Question
Related Questions
An OS design issue: File types associated with their appropriate programs 1 Answer
Making a bubble level (not a game but work tool) 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Inheritance with enemies 1 Answer