From 084d556f831832c1ca15d1e7cd52944815d9beea Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 2 May 2016 16:21:23 -0500 Subject: implemented the location fully into entity --- src/creature.cpp | 49 +++++++++++++++++++++++++------------------------ src/entity.cpp | 2 +- src/resource.cpp | 16 +++++++++------- 3 files changed, 35 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/creature.cpp b/src/creature.cpp index 83b9f4d..01882a3 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -8,9 +8,10 @@ Creature::Creature(Window m, std::string s) maxHealth = 1000; hunger = 0; - yPosition=yTarget=rand()%800; - xPosition=xTarget=rand()%1200; - hasTarget = false; + L.y=yTarget=rand()%800; + L.x=xTarget=rand()%1200; + + hasTarget = false; wandering = false; able = true; n=0; @@ -108,49 +109,49 @@ bool Creature::Action() } //Makes moves towards target coordinates - if(xPosition==xTarget) + if(L.x==xTarget) { - if(yPositionxTarget) + else if (L.x>xTarget) { - if(yPosition