I'm using Monogame to make a fighter. I have created an abstract Character class that has basic character functionality such as HP, meter, update boilerplate and such, and will be overridden as each specific character to include parameters specific to said character. The abstract Character class has a Move subclass that has mostly static functionality and takes in a delegate that handles its effects. The problem here is that most of this functionality is static and, to me, doesn't seem to need instantiating, but because the move delegate requires, at the very least, a reference to the instance of the Character that owns it (so that it can work its arbitrary effects on the character, the opponent, the environment, w/e) it seems like it needs to be instantiated, which means feeding a move in (or its delegate) as a parameter for every move I want to give a character, which is going to get very messy very fast. What should I do about this?
\$\begingroup\$
\$\endgroup\$
3
-
\$\begingroup\$ You could set the stat values to static, then when the player selects a character just add those character stats, to the static "Player stats" instead of calling the characters stats all the time. \$\endgroup\$– Ryan whiteCommented Sep 19, 2016 at 8:26
-
\$\begingroup\$ Sounds like a good time as any to use a component architecture of some description? Just have a base character skeleton and then assign it predefined behaviours from a library or something similar? \$\endgroup\$– NimphiousCommented Sep 19, 2016 at 8:31
-
1\$\begingroup\$ This is a good question for another Stack Exchange Site: Code Review. You'll get advice on Design patterns (the quality of which are usually really high), and the GameDev background should trigger a few responses :D Just be sure to include some working code, or define your issues precisely (valid anywhere on SE) \$\endgroup\$– MrBrushyCommented Sep 19, 2016 at 9:52
Add a comment
|