From f6f6d81c5634f659693914b7b74efcdd39ba5d4f Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 10 Jan 2017 09:49:32 -0600 Subject: -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) --- src/creature.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/creature.cpp') 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 ::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; } -- cgit v1.2.3