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 --- src/resource.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 src/resource.cpp (limited to 'src/resource.cpp') diff --git a/src/resource.cpp b/src/resource.cpp deleted file mode 100644 index c3e61d6..0000000 --- a/src/resource.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "resource.hpp" - -Resource::Resource(Rectangle r) -{ - rect = r; - - if(rect.x == 0 && rect.y == 0){ - rect.x = getRandom(30); - rect.y = getRandom(30); - } - - gfxData = GraphicsData(rect.x, rect.y, 0, 1, 0, RESOURCE_SIDES); - - type = RESOURCE_TYPE; - amount = RESOURCE_AMOUNT_START; - growAmount = RESOURCE_GROW; -} - -void Resource::eat(int bite) -{ - amount-=bite; -} - -void Resource::grow() -{ - if(amount < RESOURCE_AMOUNT_MAX){ - amount+=growAmount; - rect.h = rect.w = map(amount,0,RESOURCE_AMOUNT_MAX,0,RESOURCE_SIZE_MAX); - } -} -- cgit v1.2.3