summaryrefslogtreecommitdiff
path: root/src/creature.cpp
diff options
context:
space:
mode:
authortom <tom@apollo>2017-01-11 02:19:07 -0600
committertom <tom@apollo>2017-01-11 02:19:07 -0600
commitb97a54b8acd113e99871fdb0f683e27e0912bf42 (patch)
tree0c32320f225569da513a505d73dd72a506f08c95 /src/creature.cpp
parentf6f6d81c5634f659693914b7b74efcdd39ba5d4f (diff)
-removed all magic numbers and placed them in a constants header
-removed unused libraries and redid all header files
Diffstat (limited to 'src/creature.cpp')
-rw-r--r--src/creature.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/creature.cpp b/src/creature.cpp
index 7e9011a..b81153e 100644
--- a/src/creature.cpp
+++ b/src/creature.cpp
@@ -10,8 +10,8 @@ Creature::Creature(Window m, int size)
L.x = rect.x;
L.y = rect.y;
- health = 500;
- maxHealth = 1000;
+ health = CREATURE_START_HEALTH;
+ maxHealth = CREATURE_MAX_HEALTH;
hungry = false;
hasTarget = false;
@@ -61,7 +61,7 @@ void Creature::setTarget()
if(!hasTarget&&!wander){
wander = true;
- wTarget = Location(rand()%1200,rand()%800);
+ wTarget = Location(rand()%WINDOW_X,rand()%WINDOW_Y);
}
}
@@ -69,7 +69,7 @@ void Creature::setTarget()
void Creature::Action()
{
if(hasTarget){
- if(Distance(L,target->getLocation())<5){
+ if(Distance(L,target->getLocation())<reach){
target->eat();
health+=10;
}