diff options
Diffstat (limited to 'src/creature.cpp')
-rw-r--r-- | src/creature.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/creature.cpp b/src/creature.cpp index ef3d6c1..5c3bb8e 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -8,16 +8,13 @@ Creature::Creature(Window m, std::string s) //Constructor hunger = 0; //initializes random start coordinates for creature, target position is equivalent to it's position - int yStart = rand()%800; - int xStart = rand()%1200; - yPosition=yTarget=yStart; - xPosition=xTarget=xStart; + yPosition=yTarget=rand()%800; + xPosition=xTarget=rand()%1200; } void Creature::Behavior() { health--; //Decrements health each time a behavior is executed - //Detection this->Priority(); //Checks which action has priority (doesn't really do this right now) this->Action(); //Does action } @@ -28,19 +25,17 @@ void Creature::Priority() int i; for(i=0;i<location.size();i++) { - std::cout << location[i].type; if(location[i].type==2) { xTarget = location[i].x; yTarget = location[i].y; - std::cout << xTarget << "IN\n"; } } } void Creature::Action() { - //If the distance is too small, do something? + //If the distance is close, will return an bool if(sqrt(pow(xPosition - xTarget, 2) + pow(yPosition - yTarget, 2)) < 2) return; //<--- eat action should be here @@ -94,7 +89,7 @@ void Creature::Action() Location Creature::getLocation() { - //returns location vector of creatures position coordinates + //returns location object of the specific creature Location L(xPosition, yPosition, 1); return L; } |