summaryrefslogtreecommitdiff
path: root/src/creature.cpp
diff options
context:
space:
mode:
authortom <tom@apollo>2017-01-10 09:49:32 -0600
committertom <tom@apollo>2017-01-10 09:49:32 -0600
commitf6f6d81c5634f659693914b7b74efcdd39ba5d4f (patch)
tree5b51e9b82ae36c648e212cc9c95fb8233dc181c1 /src/creature.cpp
parent20717aeb1b12a7179e7b29c3c8880f18b360a1c8 (diff)
-Replaced images with colored rectangles
-Removed various functions and variables pertaining to such images -Started migrating all uses of Location to SDL_Rect (I would preferably completly remove Location.hpp) -Scaled down resolution to 1080x640 (I would like to make these global constants)
Diffstat (limited to 'src/creature.cpp')
-rw-r--r--src/creature.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/creature.cpp b/src/creature.cpp
index ead0b2d..7e9011a 100644
--- a/src/creature.cpp
+++ b/src/creature.cpp
@@ -1,16 +1,18 @@
#include "creature.hpp"
-Creature::Creature(Window m, std::string s)
+Creature::Creature(Window m, int size)
{
- texture = loadTexture(s, m);
- renderer = m.getRenderer();
- health = 500;
- maxHealth = 1000;
-
- L.y=rand()%800;
- L.x=rand()%1200;
+ Init(m);
type = 1;
+
+ rect.h = rect.w = size;
+
+ L.x = rect.x;
+ L.y = rect.y;
+ health = 500;
+ maxHealth = 1000;
+
hungry = false;
hasTarget = false;
wander = false;
@@ -42,6 +44,9 @@ void Creature::Priority()
void Creature::setTarget()
{
+ if(hasTarget)
+ return;
+
for(list <Entity*>::iterator it = N.begin(); it!=N.end(); it++){
if((*it)->getType() == 2 && hungry){
if(!hasTarget){
@@ -117,4 +122,6 @@ void Creature::Move(Location l)
L.y-=speed;
}
}
+ rect.x = L.x;
+ rect.y = L.y;
}