From 42d7b3bb511333e242a74f360873deb64cd89522 Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 2 May 2016 16:08:20 -0500 Subject: spring cleaning --- inc/creature.hpp | 21 +++++++++++---------- inc/entity.hpp | 4 +++- inc/list.hpp | 4 ++-- inc/location.hpp | 12 +++++------- inc/resource.hpp | 2 +- inc/window.hpp | 4 ++-- 6 files changed, 24 insertions(+), 23 deletions(-) (limited to 'inc') diff --git a/inc/creature.hpp b/inc/creature.hpp index 64efd26..875b498 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -15,28 +15,29 @@ class Creature: public Entity Location getLocation(); void giveR(vector n){nR=n;}; void giveC(vector n){nC=n;}; + + double Distance(Location A, Location B){return sqrt(pow(A.x-B.x,2)+pow(A.y-B.y,2));}; int getHealth(){return health;}; - double Distance(Location A, Location B); - bool doesItHaveTarget(); + bool doesItHaveTarget(){return hasTarget;}; int getBestSense(){return bestSense;}; private: - int xTarget; //x-coordinate of creature's target position - int yTarget; //y-coordinate of creature's target position + int xTarget; + int yTarget; bool hasTarget; bool wandering; - int health; //health of a creature (0-100) + int health; int maxHealth; - int hunger; //value associated with a creatures want to find food (0-100) - int speed = 1; - bool able; // ability to reproduce - int bestSense = 100; // Distance it can see/smell/hear + int hunger; + int speed = 2; + bool able; + int bestSense = 100; vector nR; //vector containing resources near the creature vector nC; //vector containing creatures near the creature - int n; // counter for which place in resource array is targeted + int n; }; #endif diff --git a/inc/entity.hpp b/inc/entity.hpp index 079da9b..803c1e4 100644 --- a/inc/entity.hpp +++ b/inc/entity.hpp @@ -2,6 +2,7 @@ #define entity_h #include "window.hpp" +#include "location.hpp" class Entity { @@ -10,8 +11,9 @@ class Entity SDL_Texture* loadTexture(std::string path, Window main); protected: + //Location L; int xPosition, yPosition; //Coordinates of entity on window - int height, width; //Dimensions of image on window + int height, width; //Dimensions of image on window int degrees = 0; SDL_Texture* texture; SDL_Renderer* renderer; diff --git a/inc/list.hpp b/inc/list.hpp index 934c319..05e9fcc 100644 --- a/inc/list.hpp +++ b/inc/list.hpp @@ -17,8 +17,8 @@ class List private: //vectors containing objects of each type Window main = Window("no");//will be needed for adding R's and C's after constructor. - std::vector R; - std::vector C; + vector R; + vector C; }; #endif diff --git a/inc/location.hpp b/inc/location.hpp index e45642d..9f50863 100644 --- a/inc/location.hpp +++ b/inc/location.hpp @@ -3,13 +3,11 @@ class Location { - public: - Location(){x=y=type=0;}; //is this line needed? - Location(int x1, int y1, int t1){x=x1;y=y1;type=t1;}; - - int x; //x-coordinate of entity - int y; //y-coordinate of entity - int type; //value associated with type of entity at location. 1: Creature, 2: Resource + public: + Location(int x1, int y1, int t1){x=x1;y=y1;type=t1;}; + int x; //x-coordinate of entity + int y; //y-coordinate of entity + int type; //value associated with type of entity at location. 1: Creature, 2: Resource }; #endif diff --git a/inc/resource.hpp b/inc/resource.hpp index c551844..5c45f96 100644 --- a/inc/resource.hpp +++ b/inc/resource.hpp @@ -14,7 +14,7 @@ class Resource: public Entity int getAmount(){return amount;}; private: - int amount; //value associated with the amount of whatever (food, etc) left in the resource + int amount; }; #endif diff --git a/inc/window.hpp b/inc/window.hpp index 1ea2733..b9f9175 100644 --- a/inc/window.hpp +++ b/inc/window.hpp @@ -1,7 +1,7 @@ #ifndef window_h #define window_h -//Theres alot here that are probs not used needs cleaning +//Theres alot here that are probs not used, needs cleaning #include #include #include @@ -19,7 +19,7 @@ class Window { public: Window(); - Window(std::string){}; + Window(string){}; void Destroy(); void Clear(); -- cgit v1.2.3