summaryrefslogtreecommitdiff
path: root/inc/organism.hpp
diff options
context:
space:
mode:
authormajortom6 <tombarrett@siu.edu>2017-02-26 11:14:31 -0600
committerTom Barrett <tombarrett@siu.edu>2017-03-07 13:23:42 -0600
commit7394b069537ed7a490a343381d62862eb22abdcf (patch)
treec8bff4f88cf962ec4148a2e133bf959035feedb7 /inc/organism.hpp
parente54170cfb8c0fb99ecdc3b1e57e832dec58ee76e (diff)
-REMOVED ENTITY, RESOURCE, AND CREATURE !
-replaced them all with one class, organism (always subject to change) -the dna type now is what differs creatures and resources -removed dead constants -may be a rogue segfault -also weird artifacts start showing if running long
Diffstat (limited to 'inc/organism.hpp')
-rw-r--r--inc/organism.hpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/inc/organism.hpp b/inc/organism.hpp
new file mode 100644
index 0000000..9534fbb
--- /dev/null
+++ b/inc/organism.hpp
@@ -0,0 +1,63 @@
+#ifndef organism_h
+#define organism_h
+
+#include <vector>
+#include <algorithm>
+
+#include "dna.hpp"
+#include "rectangle.hpp"
+#include "functions.hpp"
+
+#include "opengl/graphicsdata.hpp"
+
+class Organism
+{
+ public:
+ Organism(Rectangle r, DNA d);
+
+ void Behavior();
+ void Action();
+ void Priority();
+ void Place();
+ void setTarget();
+ void checkTarget();
+ void moveTowards(Rectangle r);
+ void passDNA(DNA d);
+ void giveNearMe(std::vector<Organism*> n){nearMe = n;};
+ void grow();
+ void takeBite(int bite);
+ void hadPregnancy(){pregnate = pregnancyReady = false;};
+
+ DNA getDNA() {return myDNA;};
+ DNA getChildsDNA() {return childsDNA;};
+ GraphicsData getGFXD() {return gfxData;};
+ Rectangle getRectangle() {return rect;};
+ int getHealth() {return health;};
+ int getBestSense() {return myDNA.bestSense;};
+ int getType() {return myDNA.type;};
+ bool getGender() {return gender;};
+ bool getPregnancyReady() {return pregnancyReady;};
+
+ private:
+ Rectangle wTarget;
+ Organism* target;
+ std::vector<Organism*> nearMe;
+ DNA myDNA;
+ DNA childsDNA;
+ Rectangle rect;
+ GraphicsData gfxData;
+
+ int health;
+ int pregnancyTime;
+ int age;
+
+ bool gender;
+ bool pregnate;
+ bool hungry;
+ bool pregnancyReady;
+ bool able;
+ bool hasTarget;
+ bool wander;
+};
+
+#endif