Skip to content

Commit

Permalink
➕ added Initial classes code
Browse files Browse the repository at this point in the history
  • Loading branch information
habibayman committed Apr 3, 2024
1 parent 88505bd commit 930f010
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Alien-Invasion.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<ClInclude Include="Containers\PriorityQueue.h" />
<ClInclude Include="Containers\QueueADT.h" />
<ClInclude Include="Containers\StackADT.h" />
<ClInclude Include="UnitClasses\AlienDrone.h" />
<ClInclude Include="UnitClasses\AlienMonster.h" />
<ClInclude Include="UnitClasses\AlienSolider.h" />
<ClInclude Include="UnitClasses\EarthGunnery.h" />
<ClInclude Include="UnitClasses\EarthSolider.h" />
<ClInclude Include="UnitClasses\EarthTank.h" />
<ClInclude Include="UnitClasses\Unit.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
Expand Down
9 changes: 9 additions & 0 deletions UnitClasses/AlienDrone.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ALIENDRONE_H
#define ALIENDRONE_H

#include "Unit.h"
class AlienDrone :public Unit
{

};
#endif
9 changes: 9 additions & 0 deletions UnitClasses/AlienMonster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ALIENMONSTER_H
#define ALIENMONSTER_H

#include "Unit.h"
class AlienMonster :public Unit
{

};
#endif
9 changes: 9 additions & 0 deletions UnitClasses/AlienSolider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ALIENSOLIDER_H
#define ALIENSOLIDER_H

#include "Unit.h"
class AlienSolider :public Unit
{

};
#endif
10 changes: 10 additions & 0 deletions UnitClasses/EarthGunnery.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef EARTHGUNNERY_H
#define EARTHGUNNERY_H

#include "Unit.h"
class EearthGunnery :public Unit
{

};
#endif

10 changes: 10 additions & 0 deletions UnitClasses/EarthSolider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef EARTHSOLIDER_H
#define EARTHSOLIDER_H

#include "Unit.h"
class EearthSolider :public Unit
{

};
#endif

10 changes: 10 additions & 0 deletions UnitClasses/EarthTank.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef EARTHTANK_H
#define EARTHTANK_H

#include "Unit.h"
class EearthTank :public Unit
{

};
#endif

28 changes: 28 additions & 0 deletions UnitClasses/Unit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef UNIT_H
#define UNIT_H

enum UnitType
{
ES, EG, ET,
AS, AD, AM
};
class Unit
{
UnitType unitType;
int id;
int joinTime;
int health;
int power;
int attackCapacity;
public:
void recieveDamage(int loss);
virtual void print() = 0;
virtual void attack(Unit* aUnit) = 0; //shouldn't it be passed a list??? will check later

};
#endif

void Unit:: recieveDamage(int loss)
{
health -= loss;
}

0 comments on commit 930f010

Please sign in to comment.