From 34d1b8f9e9aaac9a548d4c49c26dabc670f371e5 Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Sat, 24 Dec 2011 22:45:21 +0000 Subject: [PATCH] [Add] Making a start adding character health. Testing branches more than anything.. --- src/Unuk/Player.cpp | 2 ++ src/Unuk/Player.h | 2 ++ src/libUnuk/Character.cpp | 3 ++- src/libUnuk/Character.h | 21 +++++++++++++-------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Unuk/Player.cpp b/src/Unuk/Player.cpp index ddcba46..1f6afb2 100644 --- a/src/Unuk/Player.cpp +++ b/src/Unuk/Player.cpp @@ -58,6 +58,8 @@ void Player::HandleInput(void) { void Player::Update(void) { Move(); AddSpeachBubble("Woot, My name is Allanis, welcome to my home"); + + // For now The camera will be static. //SetCamera(); } diff --git a/src/Unuk/Player.h b/src/Unuk/Player.h index 64aee27..fb5db4b 100644 --- a/src/Unuk/Player.h +++ b/src/Unuk/Player.h @@ -5,6 +5,7 @@ #include "Globals.h" #include "Constants.h" #include "../libUnuk/Character.h" +#include "../libUnuk/Debug.h" class Player : public Character { public: @@ -26,6 +27,7 @@ private: static const float PLAYER_SPEED; string _name; + //int _health; }; #endif diff --git a/src/libUnuk/Character.cpp b/src/libUnuk/Character.cpp index 125867c..1d75cf9 100644 --- a/src/libUnuk/Character.cpp +++ b/src/libUnuk/Character.cpp @@ -13,7 +13,8 @@ Character::Character(Map* mapArg) { _animationStage = ANIM_NO_FOOT; _animationTimer.Start(); _leftFoot = false; - + _health = 100; + xVel = 0.0f; yVel = 0.0f; diff --git a/src/libUnuk/Character.h b/src/libUnuk/Character.h index b09c4b2..776c99e 100644 --- a/src/libUnuk/Character.h +++ b/src/libUnuk/Character.h @@ -24,14 +24,17 @@ public: void LoadSprites(string filename, int wArg, int hArg); - float GetX(void) { return x; } - float GetY(void) { return y; } - float GetWidth(void) { return w; } - float GetHeight(void) { return h; } + 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; } - void SetXVelocity(float arg) { xVel = arg; } - void SetYVelocity(float arg) { yVel = arg; } + void SetXY(float xArg, float yArg) { x = xArg, y = yArg; } + void SetXVelocity(float arg) { xVel = arg; } + void SetYVelocity(float arg) { yVel = arg; } + + void SetHealth(int health) { _health = health; } + int GetHealth(void) { return _health; } void AddSpeachBubble(string text); @@ -58,6 +61,8 @@ protected: Timer attackTimer; bool attacking; + + int _health; Map* map; @@ -73,7 +78,7 @@ protected: static const int ANIM_NO_FOOT = 1; static const int ANIM_RIGHT_FOOT = 2; static const int ANIM_ATTACK = 3; - + private: static const int ANIMATION_SPEED = 200; static const int ATTACKING_DISPLAY_LEN = 150;