From 7394b069537ed7a490a343381d62862eb22abdcf Mon Sep 17 00:00:00 2001 From: majortom6 Date: Sun, 26 Feb 2017 11:14:31 -0600 Subject: -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 --- inc/organism.hpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 inc/organism.hpp (limited to 'inc/organism.hpp') 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 +#include + +#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 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 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 -- cgit v1.2.3