1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
#include "GameObject.h"
GameObject::GameObject()
{
//ctor
}
void GameObject::PlayMap()
{
Goblin GoblinObj;
Orc OrcObj;
Bat BatObj;
Spirit SpiritObj;
Skeleton SkelentonObj;
DarkKnight DarkKnightObj;
CarnivorousHorse CarnivorousHorseObj;
STDMonster STDMonsterObj;
InsectSwarm InsectSwarmObj;
Dog DogObj;
MrGappube MrGappubeObj;
FootballMonster FootballMonsterObj;
DemonStripOGram DemonStripOGramObj;
Enemy *EnemyGoblin = &GoblinObj;
Enemy *EnemyOrc = &OrcObj;
Enemy *EnemyBat = &BatObj;
Enemy *EnemySpirit = &SpiritObj;
Enemy *EnemySkeleton = &DarkKnightObj;
Enemy *EnemyCarnivorousHorse = &CarnivorousHorseObj;
Enemy *EnemySTDMonster = &STDMonsterObj;
Enemy *EnemyInsectSwarm = &InsectSwarmObj;
Enemy *EnemyDog = &DogObj;
Enemy *EnemyMrGappube = &MrGappubeObj;
Enemy *EnemyFootballMonster = &FootballMonsterObj;
Enemy *EnemyDemonStripOGram = &DemonStripOGramObj;
EquateTextPrint();
};
//Works out the directions in which the player may travel and prints them to the screen.
void GameObject::DirectionCheck()
{
bool DirectionSpecifier[4];
int DirectionSpecifierCount = 0;
if(locy<Mpo.getRows())
{
if(Mpo.ReadMap(locx,locy+1)!=0)
{
DirectionSpecifier[North]=1;
DirectionSpecifierCount++;
}
}
else
{
DirectionSpecifier[North]=0;
}
if(locx<Mpo.getCols())
{
if(Mpo.ReadMap(locx+1,locy)!=0)
{
DirectionSpecifier[East]=1;
DirectionSpecifierCount++;
}
}
else
{
DirectionSpecifier[East]=0;
}
if(locy>0)
{
if(Mpo.ReadMap(locx,locy-1)!=0)
{
DirectionSpecifier[South]=1;
DirectionSpecifierCount++;
}
}
else
{
DirectionSpecifier[South]=0;
}
if(locx>0)
{
if(Mpo.ReadMap(locx-1,locy)!=0)
{
DirectionSpecifier[West]=1;
DirectionSpecifierCount++;
}
}
else
{
DirectionSpecifier[West]=0;
}
for(int i=0; i<4; i++)
{
if(DirectionSpecifier[i]!=0 && DirectionSpecifierCount>2)
{
switch(i)
{
case 0:
cout << "north, ";
break;
case 1:
cout << "east, ";
break;
case 2:
cout << "south, ";
break;
case 3:
cout << "west, ";
break;
}
DirectionSpecifierCount--;
}
else if(DirectionSpecifier[i]!=0 && DirectionSpecifierCount>1)
{
switch(i)
{
case 0:
cout << "north and ";
break;
case 1:
cout << "east and ";
break;
case 2:
cout << "south and ";
break;
case 3:
cout << "west and ";
break;
}
DirectionSpecifierCount--;
}
else if(DirectionSpecifierCount=1 && DirectionSpecifier[i]!=0)
{
switch(i)
{
case 0:
cout << "north.";
break;
case 1:
cout << "east.";
break;
case 2:
cout << "south.";
break;
case 3:
cout << "west.";
break;
}
DirectionSpecifierCount--;
}
}
}
//This function is not yet finished.
void GameObject::EquateTextPrint()
{
switch(Mpo.ReadMap(locx,locy))
{
case 1:
cout << "You can move: ";
DirectionCheck();
break;
case 3:
if(IgnoreSpecifier=0)
{
cout << "You approach the exit to the map. Do you wish to leave, or are you wishing to stay and find the riches of the land?" << endl;
}
if(IgnoreSpecifier=1)
{
cout << "You can still end this level if you want. If not, you can move: ";
DirectionCheck();
cout << endl;
}
case 4:
cout << "You approach an ugly, smelly goblin. He grasps a dagger from the pocket of his weak armour and points it at you, ready to fight.";
default:
cout << "Something is wrong with this map.....";
break;
};
cout << "This works";
};
GameObject::~GameObject()
{
//dtor
}
|