diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/creature.cpp | 9 | ||||
-rw-r--r-- | src/creature.cpp~ | 47 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/resource.cpp~ | 8 |
4 files changed, 5 insertions, 60 deletions
diff --git a/src/creature.cpp b/src/creature.cpp index 437837d..207d3bd 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -13,9 +13,9 @@ Creature::Creature(Window m, std::string s) void Creature::Behavior() { //Detection - + //Priorities - + //Action this->Action(); } @@ -26,7 +26,7 @@ void Creature::Action() // eat//reproduce//etc; if(x==xT) - { + { if(y<yT) y++; else @@ -42,7 +42,6 @@ void Creature::Action() else { srand(time(NULL)); - z = rand%1; - if( + int z = rand()%1; } } diff --git a/src/creature.cpp~ b/src/creature.cpp~ deleted file mode 100644 index 15b6577..0000000 --- a/src/creature.cpp~ +++ /dev/null @@ -1,47 +0,0 @@ -#include "creature.h" - -Creature::Creature(Window m, std::string s) -{ - texture = loadTexture(s, m); - renderer = m.getRenderer(); - x=y=500; - - //For the test resource - xT=yT=300; -} - -void Creature::Behavior() -{ - //Detection - - //Priorities - - //Action - this->Action(); -} - -void Creature::Action() -{ - //if(isclose) - // eat//reproduce//etc; - - if(x==xT) - { - if(y<yT) - y++; - else - y--; - } - else if(y==yT) - { - if(x<xT) - x++; - else - x--; - } - else - { - - - } -} diff --git a/src/main.cpp b/src/main.cpp index eaa449d..087ec78 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ int main() // eventHandle(e.gEvent());
}
main.Clear();
+ testcreature.Behavior();
testcreature.Place();
testresource.Place();
main.Render();
diff --git a/src/resource.cpp~ b/src/resource.cpp~ deleted file mode 100644 index 06c7a04..0000000 --- a/src/resource.cpp~ +++ /dev/null @@ -1,8 +0,0 @@ -#include "resource.h" - -Resource::Resource(Window m, std::string s) -{ - texture = loadTexture(s, m); - renderer = m.getRenderer(); - x=y=300; -} |