diff options
author | tom <tom@explorer> | 2015-05-01 14:42:07 -0500 |
---|---|---|
committer | tom <tom@explorer> | 2015-05-01 14:42:07 -0500 |
commit | 467a25d8db798e8b590773bb0b89eac36537b87a (patch) | |
tree | e2297efc4bdf900abfacd3e85eaee7445c34a0f3 | |
parent | 386279f378d49f6dddb276fbfde92fe1444b6ea1 (diff) |
removed temp and made compilable
-rw-r--r-- | inc/creature.h~ | 16 | ||||
-rw-r--r-- | inc/window.h~ | 24 | ||||
-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 |
6 files changed, 5 insertions, 100 deletions
diff --git a/inc/creature.h~ b/inc/creature.h~ deleted file mode 100644 index 19d4cb3..0000000 --- a/inc/creature.h~ +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef creature_h -#define creature_h - -#include "entity.h" - -class Creature: public Entity -{ - public: - Creature(Window m, std::string s); - void Behavior(); - private: - int xT; - int yT; -}; - -#endif diff --git a/inc/window.h~ b/inc/window.h~ deleted file mode 100644 index fb1cf67..0000000 --- a/inc/window.h~ +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef window_h -#define window_h - -#include <SDL2/SDL.h> -#include <SDL2/SDL_image.h> -#include <string> -#include <cmath> - -class Window -{ - public: - Window(); - void Destroy(); - - void Clear(); - void Render(); - SDL_Renderer* getRenderer(); - - private: - SDL_Window* main; - SDL_Renderer* renderer; -}; - -#endif 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; -} |