Original Post
Hi, I''m starting an RPG battle system. When an action is chosen during combat, the appropriate move function is performed after "switch-caseing" the index of the action selected.
Ex.
switch(index) {
case ATTACK:
DoAttack();
break;
case DEFEND:
Defend();
break;
}
However, with this system I have to re-determin the selection every frame.
I thought up a possible solution, but I''m not sure how to execute it.
My character class has a function called Action(). Can I assign this function to another particular function? That is, make the character''s Action() function point to the appropriate function (such as Attack() or Defend()) and just call character.Action() each frame instead of re-determining the chosen move every frame?