From 6b967f3bd7a3e7203b57bd9e4edb0db82bc9ed1c Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 26 May 2015 14:04:04 -0500 Subject: revamped the list and creatures two bugs i can see right now -somehow when a resource has less than 0 amount it still sticks around (somewhat rare) -some creatures just bounce back and forth until they die not getting to their target --- inc/creature.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'inc/creature.hpp') diff --git a/inc/creature.hpp b/inc/creature.hpp index 7c5c8cb..24cad37 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -2,6 +2,7 @@ #define creature_h #include "entity.hpp" +#include "resource.hpp" #include "location.hpp" class Creature: public Entity @@ -12,15 +13,19 @@ class Creature: public Entity bool Action(); void Priority(); Location getLocation(); - void giveKnown(std::vector Z){location = Z;}; + void give(vector n){nR=n;}; int getHealth(){return health;}; + double Distance(Location A, Location B); private: int xTarget; //x-coordinate of creature's target position int yTarget; //y-coordinate of creature's target position + bool hasTarget; int health; //health of a creature (0-100) int hunger; //value associated with a creatures want to find food (0-100) - std::vector location; //vector containing objects near the creature + int speed = 1; + vector nR; //vector containing objects near the creature + int n; // counter for which place in resource array is targeted }; #endif -- cgit v1.2.3