I have gone and done it this time. I spent the past few weeks working on this game and now I don't know how to finish it.
The game has these tanks that drive and shoot.
I have functions that move the tanks. Like,
void driveforward() {...} and
void turnright() {...}.
Up till now, pressing on the keyboard will trigger a function call. Arrow keys steer and spacebar shoots. It all works fine, but I wanted to remove the keyboard controls from the game. This game is about programming your tank to do battle.
I want the players to choose in advance the order of function calls and then when the game starts the tanks go at it.
Is there a way to make a vector of function calls? How would I do this? Thanks for any help.
It is preferable to use vector of function object as naraku9333 suggested instead of raw function pointer: you can store normal functions, member functions, lambdas, binded functions and functors here easily.