Saturday, September 16, 2023

Bloons Game

 A stupid game demonstrating several patterns in the code.

//**Constants related to starting game**                                                                                                                                                                    
const int START_ROUND = 1; //Starting round                                                                                                                                                                
const int START_LIFE = 100; //Starting life (num damage before losing game)                                                                                                                                
const int START_MONEY = 10; //Starting money for player                                                                                                                                                    

//Constants related to the length of the path                                                                                                                                                              
const int PATH_LENGTH = 3; //Length of the path (could be anything)                                                                                                                                        
const int START_BLOON = -1; //Starting location of all bloons                                                                                                                                              

//**Constants related to money/cost**                                                                                                                                                                      
const int COST_DART = 2; //Starting cost for dart monkey                                                                                                                                                    
const int COST_BOOMERANG = 4; //Starting cost for boomerang monkey                                                                                                                                          
const int COST_BOMB = 6; //Starting cost for a bomb monkey                                                                                                                                                  
const int COST_IMPROVE = 2; //Cost for each improvement (regardless of type)                                                                                                                                
const int EARN_POP = 1; //Earnings per pop of a bloon                                                                                                                                                      
const int IMPROVE_VALUE = 2; //When a bloon is improved, increases the value based on this                                                                                                                  

//**Constants related to damage**                                                                                                                                                                          
const int DAMAGE_DART = 1; //Starting damage for dart monkey                                                                                                                                                
const int DAMAGE_BOOM = 1; //Starting damage for boomerage monkey                                                                                                                                          
const int DAMAGE_BOMB = 1; //Starting damage for bomb monkey                                                                                                                                                
//******************************************************

The project has three types of Baloons. Dart, Boomerang and Bomb. Each are deriving from Monkey.

Basic is deriving from Bloon.

Monkey is a stand alone class.

This project demonstrates the concept of inheritance and polymorphism.

No comments:

Post a Comment