From ffcee12acf3fe3f972f322c18b3203212682205d Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 7 May 2015 12:35:15 -0500 Subject: woo! detection is implemented albeit shitty --- inc/creature.hpp | 4 +++- inc/list.hpp | 1 + inc/location.hpp | 8 +++----- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/creature.hpp b/inc/creature.hpp index f72dfbc..a0046fb 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -10,14 +10,16 @@ class Creature: public Entity Creature(Window m, std::string s); void Behavior(); void Action(); + void Priority(); Location getLocation(); + void giveKnown(std::vector Z){K=Z;}; private: int xT; int yT; int hp; int hu; - Location K[3]; + std::vector K; }; #endif diff --git a/inc/list.hpp b/inc/list.hpp index 203ad7f..96509aa 100644 --- a/inc/list.hpp +++ b/inc/list.hpp @@ -12,6 +12,7 @@ class List List(Window m); void Behavior(); void Place(); + double Distance(Location A, Location B); private: //Window main; diff --git a/inc/location.hpp b/inc/location.hpp index 2042734..6a20b4e 100644 --- a/inc/location.hpp +++ b/inc/location.hpp @@ -5,11 +5,9 @@ class Location { public: Location(){x=y=t=0;}; - Location(int x, int y, int z){}; - int getType(){return t;}; - - private: - int x; + Location(int x1, int y1, int t1){x=x1;y=y1;t=t1;}; + + int x; int y; int t; }; -- cgit v1.2.3 From c63d77ddddb69ef0f641d90a8c3922fdc356224c Mon Sep 17 00:00:00 2001 From: dakjos Date: Thu, 7 May 2015 19:53:39 -0500 Subject: Some variable names changed and many comments made so I understand what the fuck is going on --- inc/creature.hpp | 12 ++++++------ inc/entity.hpp | 4 ++-- inc/list.hpp | 2 +- inc/location.hpp | 10 +++++----- inc/resource.hpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'inc') diff --git a/inc/creature.hpp b/inc/creature.hpp index a0046fb..9a26ee8 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -12,14 +12,14 @@ class Creature: public Entity void Action(); void Priority(); Location getLocation(); - void giveKnown(std::vector Z){K=Z;}; + void giveKnown(std::vector Z){location = Z;}; private: - int xT; - int yT; - int hp; - int hu; - std::vector K; + int xTarget; //x-coordinate of creature's target position + int yTarget; //y-coordinate of creature's target position + 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 creatures location on window or target location? }; #endif diff --git a/inc/entity.hpp b/inc/entity.hpp index 5ed2e74..079da9b 100644 --- a/inc/entity.hpp +++ b/inc/entity.hpp @@ -10,8 +10,8 @@ class Entity SDL_Texture* loadTexture(std::string path, Window main); protected: - int x, y; - int height, width; + int xPosition, yPosition; //Coordinates of entity 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 96509aa..074e045 100644 --- a/inc/list.hpp +++ b/inc/list.hpp @@ -15,7 +15,7 @@ class List double Distance(Location A, Location B); private: - //Window main; + //vectors containing objects of each type std::vector R; std::vector C; std::vector L; diff --git a/inc/location.hpp b/inc/location.hpp index 6a20b4e..8bd512c 100644 --- a/inc/location.hpp +++ b/inc/location.hpp @@ -4,12 +4,12 @@ class Location { public: - Location(){x=y=t=0;}; - Location(int x1, int y1, int t1){x=x1;y=y1;t=t1;}; + Location(){x=y=type=0;}; //is this line needed? + Location(int x1, int y1, int t1){x=x1;y=y1;type=t1;}; - int x; - int y; - int t; + 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 2738f44..383e9ef 100644 --- a/inc/resource.hpp +++ b/inc/resource.hpp @@ -11,7 +11,7 @@ class Resource: public Entity Location getLocation(); private: - int amount; + int amount; //value associated with the amount of whatever (food, etc) left in the resource }; #endif -- cgit v1.2.3 From 8c5121486a0e5d94ae5e5ee67370a31530cf8b6f Mon Sep 17 00:00:00 2001 From: tom Date: Fri, 8 May 2015 08:23:06 -0500 Subject: fixed some comments and cleaned around --- inc/creature.hpp | 2 +- inc/list.hpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/creature.hpp b/inc/creature.hpp index 9a26ee8..9bb73ee 100644 --- a/inc/creature.hpp +++ b/inc/creature.hpp @@ -19,7 +19,7 @@ class Creature: public Entity int yTarget; //y-coordinate of creature's target position 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 creatures location on window or target location? + std::vector location; //vector containing objects near the creature }; #endif diff --git a/inc/list.hpp b/inc/list.hpp index 074e045..dc5c412 100644 --- a/inc/list.hpp +++ b/inc/list.hpp @@ -16,6 +16,7 @@ class List private: //vectors containing objects of each type + Window * main;//will be needed for adding R's and C's after constructor. std::vector R; std::vector C; std::vector L; -- cgit v1.2.3