From abf81b7c3c99b0ab741691a992d6843e381698de Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Wed, 20 Nov 2013 14:18:31 +0100 Subject: [PATCH 1/2] added weapon and connected it to player changed player --- Code/GameLogic/Game.cpp | 1 + Code/GameLogic/Player.h | 5 +++-- Code/GameLogic/Weapon.cpp | 12 ++++++++++++ Code/GameLogic/Weapon.h | 21 +++++++++++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 Code/GameLogic/Weapon.cpp create mode 100644 Code/GameLogic/Weapon.h diff --git a/Code/GameLogic/Game.cpp b/Code/GameLogic/Game.cpp index 805e25b9..c74958dd 100644 --- a/Code/GameLogic/Game.cpp +++ b/Code/GameLogic/Game.cpp @@ -4,6 +4,7 @@ using namespace GameLogic; Game::Game(void) { + } diff --git a/Code/GameLogic/Player.h b/Code/GameLogic/Player.h index 1b53740b..eca9d65b 100644 --- a/Code/GameLogic/Player.h +++ b/Code/GameLogic/Player.h @@ -2,6 +2,7 @@ #define PLAYER_H #include "Object.h" +#include "Weapon.h" namespace GameLogic { @@ -19,8 +20,8 @@ namespace GameLogic void Shoot(); private: - //Life - //weapon + int life; + Weapon *weapon; }; } diff --git a/Code/GameLogic/Weapon.cpp b/Code/GameLogic/Weapon.cpp new file mode 100644 index 00000000..2cbd4e71 --- /dev/null +++ b/Code/GameLogic/Weapon.cpp @@ -0,0 +1,12 @@ +#include "Weapon.h" + +using namespace GameLogic; + +Weapon::Weapon(void) +{ +} + + +Weapon::~Weapon(void) +{ +} diff --git a/Code/GameLogic/Weapon.h b/Code/GameLogic/Weapon.h new file mode 100644 index 00000000..72a335d4 --- /dev/null +++ b/Code/GameLogic/Weapon.h @@ -0,0 +1,21 @@ +#ifndef WEAPON_H +#define WEAPON_H + +#include "Object.h" + +namespace GameLogic +{ + + class Weapon : public Object + { + + public: + Weapon(void); + ~Weapon(void); + + private: + + }; + +} +#endif \ No newline at end of file From 717b4251471186f91591e259676a068350557a4c Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Wed, 20 Nov 2013 14:25:37 +0100 Subject: [PATCH 2/2] split worldObject into dynamic and static types --- Code/GameLogic/DynamicObject.cpp | 11 +++++++++++ Code/GameLogic/DynamicObject.h | 20 ++++++++++++++++++++ Code/GameLogic/StaticObject.cpp | 11 +++++++++++ Code/GameLogic/StaticObject.h | 20 ++++++++++++++++++++ Code/GameLogic/WorldObject.cpp | 12 ------------ Code/GameLogic/WorldObject.h | 22 ---------------------- 6 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 Code/GameLogic/DynamicObject.cpp create mode 100644 Code/GameLogic/DynamicObject.h create mode 100644 Code/GameLogic/StaticObject.cpp create mode 100644 Code/GameLogic/StaticObject.h delete mode 100644 Code/GameLogic/WorldObject.cpp delete mode 100644 Code/GameLogic/WorldObject.h diff --git a/Code/GameLogic/DynamicObject.cpp b/Code/GameLogic/DynamicObject.cpp new file mode 100644 index 00000000..784f04cf --- /dev/null +++ b/Code/GameLogic/DynamicObject.cpp @@ -0,0 +1,11 @@ +#include "DynamicObject.h" + + +DynamicObject::DynamicObject(void) +{ +} + + +DynamicObject::~DynamicObject(void) +{ +} diff --git a/Code/GameLogic/DynamicObject.h b/Code/GameLogic/DynamicObject.h new file mode 100644 index 00000000..445b2e7b --- /dev/null +++ b/Code/GameLogic/DynamicObject.h @@ -0,0 +1,20 @@ +#ifndef DYNAMICOBJECT_H +#define DYNAMICOBJECT_H + +#include "Object.h" + +namespace GameLogic +{ + + class DynamicObject : public Object + { + + public: + DynamicObject(void); + ~DynamicObject(void); + + }; + +} + +#endif \ No newline at end of file diff --git a/Code/GameLogic/StaticObject.cpp b/Code/GameLogic/StaticObject.cpp new file mode 100644 index 00000000..fee6e62a --- /dev/null +++ b/Code/GameLogic/StaticObject.cpp @@ -0,0 +1,11 @@ +#include "StaticObject.h" + + +StaticObject::StaticObject(void) +{ +} + + +StaticObject::~StaticObject(void) +{ +} diff --git a/Code/GameLogic/StaticObject.h b/Code/GameLogic/StaticObject.h new file mode 100644 index 00000000..8637e460 --- /dev/null +++ b/Code/GameLogic/StaticObject.h @@ -0,0 +1,20 @@ +#ifndef STATICOBJECT_H +#define STATICOBJECT_H + +#include "Object.h" + +namespace GameLogic +{ + + class StaticObject : public Object + { + + public: + StaticObject(void); + ~StaticObject(void); + + }; + +} + +#endif \ No newline at end of file diff --git a/Code/GameLogic/WorldObject.cpp b/Code/GameLogic/WorldObject.cpp deleted file mode 100644 index 880f120b..00000000 --- a/Code/GameLogic/WorldObject.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "WorldObject.h" - -using namespace GameLogic; - -WorldObject::WorldObject(void) -{ -} - - -WorldObject::~WorldObject(void) -{ -} diff --git a/Code/GameLogic/WorldObject.h b/Code/GameLogic/WorldObject.h deleted file mode 100644 index 9f15a62d..00000000 --- a/Code/GameLogic/WorldObject.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef WORLDOBJECT_H -#define WORLDOBJECT_H - -#include "Object.h" - -namespace GameLogic -{ - - class WorldObject : public Object - { - - public: - WorldObject(void); - ~WorldObject(void); - - private: - - - }; - -} -#endif \ No newline at end of file