From a9281bfcf21861e621a3243ecb633a299c8d8e52 Mon Sep 17 00:00:00 2001 From: tom Date: Sat, 21 Jan 2017 08:58:12 -0600 Subject: -took basic math functions and put it into functions.hpp -spaced various lines -reorganized variables by datatype -implemented reproduction -reorganized pathing so once a target is set, the creature checks if that same target is near every cycle --- inc/creature.hpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'inc/creature.hpp') diff --git a/inc/creature.hpp b/inc/creature.hpp index edc253f..79ec4c3 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -6,28 +6,32 @@ #include "entity.hpp" #include "constants.hpp" +#include "functions.hpp" class Creature: public Entity { public: Creature(Window m, SDL_Rect R); - void Behavior(); - void Action(); - void Priority(); - void setTarget(); - void Move(SDL_Rect R); - + void Behavior(); + void Action(); + void Priority(); + void setTarget(); + void checkTarget(); + void Move(SDL_Rect R); + void impregnate(); void giveN(list n){N = n;}; - double Distance(SDL_Rect A, SDL_Rect B){return sqrt(pow(A.x-B.x,2)+pow(A.y-B.y,2));}; + int getHealth(){return health;}; - bool doesItHaveTarget(){return hasTarget;}; int getBestSense(){return bestSense;}; - + bool getGender(){return gender;}; + bool getPregnancyReady(){return pregnancyReady;}; + void hadPregnancy(){pregnate = pregnancyReady = false;}; + private: - bool hasTarget; - bool wander; - SDL_Rect wTarget; - + SDL_Rect wTarget; + Entity *target; + list N; + int health; int reach; int maxHealth; @@ -36,13 +40,14 @@ class Creature: public Entity int bite; int amountAte; int amountToGrow; + int pregnancyTime; + int expectedPregnancyTime; bool hungry; - bool gender; + bool pregnancyReady; bool able; - - list N; - Entity *target; + bool hasTarget; + bool wander; }; #endif -- cgit v1.2.3