From de6bd2d39557fe6ed3177c2f56dcee755fcb514d Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Thu, 12 Apr 2012 18:55:13 +0100 Subject: [PATCH] [Add] Initial actor base class. --- LibDQt/LibDQt.pro | 6 ++++-- src/Actor/Actor.cpp | 9 +++++++++ src/Actor/Actor.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/Actor/Actor.cpp create mode 100644 src/Actor/Actor.h diff --git a/LibDQt/LibDQt.pro b/LibDQt/LibDQt.pro index b998845..acdf8a4 100644 --- a/LibDQt/LibDQt.pro +++ b/LibDQt/LibDQt.pro @@ -54,7 +54,8 @@ HEADERS += ../src/Actor/Player.h \ ../src/TMXParser/base64.h \ ../src/Collision/TileCollision.h \ ../src/Actor/NPC.h \ - ../src/Sound/SoundEffect.h + ../src/Sound/SoundEffect.h \ + ../src/Actor/Actor.h SOURCES += ../src/Actor/Player.cpp \ ../src/Collision/AABB.cpp \ ../src/Global/Globals.cpp \ @@ -85,5 +86,6 @@ SOURCES += ../src/Actor/Player.cpp \ ../src/TMXParser/TmxImage.cpp \ ../src/TMXParser/base64.cpp \ ../src/Actor/NPC.cpp \ - ../src/Sound/SoundEffect.cpp + ../src/Sound/SoundEffect.cpp \ + ../src/Actor/Actor.cpp OTHER_FILES += diff --git a/src/Actor/Actor.cpp b/src/Actor/Actor.cpp new file mode 100644 index 0000000..e5b79b5 --- /dev/null +++ b/src/Actor/Actor.cpp @@ -0,0 +1,9 @@ +#include "Actor.h" + +Actor::Actor(void) : VELOCITY(10.0f) { + +} + +Actor::~Actor(void) { + +} diff --git a/src/Actor/Actor.h b/src/Actor/Actor.h new file mode 100644 index 0000000..30bc2e9 --- /dev/null +++ b/src/Actor/Actor.h @@ -0,0 +1,34 @@ +#pragma once + +class Actor { +public: + enum State { + WALKING, + RUNNING, + ATTACKING, + }; + + enum Facing { + FRONT, + BACK, + LEFT, + RIGHT + }; + + Actor(void); + ~Actor(void); + + float GetX(void) { return x; } + float GetY(void) { return y; } + float GetWidth(void) { return w; } + float GetHeight(void) { return h; } + + void SetXY(float xArg, float yArg) { x = xArg; y = yArg; } + +private: + const float VELOCITY; + float x; + float y; + float w; + float h; +};