Capture the Flag Part 3
Posted Nov 7th, 2009 by ConorI have been flat out recently with school and work and this ICSP thing. Well anyway I have had no time to do any furasta or any independent spur of the moment programing! It’s driving me crazy, but hey, it’s all over in just over 6 months….
Capture the Flag Part 3
This time I have deviated from the rules a wee bit. The red player is controlled by the CPU, while the user controls the blue player. Once again the objective is to capture the red flag and return it to your blue base. If you bump into a player who has a flag then flag gets returned to it’s base.
The players, and flags have three random starting positions each. I have re-written this example from scratch, not using any of the code from part one or two. I am happy with the code this time, and have done my best to make it effective.
The red player has two modes, aggressive and defensive. When the game starts the red player attempts to capture the flag and return it to it’s red base automatically. If at any point the blue player acquires his flag the red player will go into defensive mode and attempt to recover his flag.
To throw a spanner in the works I have added a BOOST and an obstacle. The boost can gradually makes the player who absorbs it smaller to increase evasive skills. It also makes the player a lot faster. The obstacle has two modes. If you bump into it the wrong way, you will simply bump off it. If you follow the arrows through the obstacle with your player then you will receive a big speed bonus. Both these items will prove vital in winning against the red player, who moves faster than the blue one.
Controls
Up Key – Move Up
Down Key – Move Down
Left Key – Move Left
Right Key – Move Right