From aaf0a73578ecbb8212e0d224d6fff68a229b1f48 Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 5 May 2015 21:01:52 -0500 Subject: fleshed out list, locations of all creatures and resources are now within --- src/creature.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/creature.cpp') diff --git a/src/creature.cpp b/src/creature.cpp index 8e86c0d..cc3fa08 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -4,23 +4,25 @@ Creature::Creature(Window m, std::string s) { texture = loadTexture(s, m); renderer = m.getRenderer(); + hp = 100; + hu = 0; - srand(time(NULL)); - int z = rand()%800; - y=z; - - z = rand()%800; - x=z; - std::cout << x << ' ' << y << std::endl; - + int zy = rand()%800; + int zx = rand()%1200; + y=zy; + x=zx; + //std::cout << x << ' ' << y << std::endl; + //For the test resource xT=yT=300; } void Creature::Behavior() { + hp--; //Detection + //Priorities //Action @@ -34,15 +36,19 @@ void Creature::Action() return; //eat//reproduce//etc; if(x==xT) + { if(y