Godot Version
4.2.2
Question
This is a “design pattern” question. Imagine games such as Super Smash that you have so many characters that you or AI could control. If we are to program something like that, I believe we will need to create something like:
- an abstract character class that has abstracted functions/methods which will be defined further in each character class itself. Each character should be its own “state machine”.
- “something” that takes your inputs and send all these input messages to the “character object” you are controlling. This “something” should have a reference to the “character object” and invoke the appropriate function/method along with passing the inputs.
- In the case of having an AI opponent, the “something” in number 2 would evaluate the game world and send appropriate messages to its character to attack, save itself, etc.
So in Godot, how could the above be accomplished? How does Godot deal with abstraction, and calling function/methods of a class?