diff options
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 19ac536..849bd7c 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -8,6 +8,7 @@ void Entity::spawn(float x, float y){ right = false; left = false; } + void Entity::draw(void){ glColor3ub(0,0,100); glRectf(loc.x,loc.y,loc.x+width,loc.y+height); @@ -18,10 +19,7 @@ Player::Player(){ height = HLINE * 18; speed = 1; type = 0; -} - -Player::~Player(){ - + subtype = 5; } NPC::NPC(){ @@ -29,4 +27,28 @@ NPC::NPC(){ height = HLINE * 18; speed = 1; type = 0; + subtype = 0; +} + +Structures::Structures(){ + type = -1; + speed = 0; +} + +void Structures::spawn(int t, float x, float y){ + loc.x = x; + loc.y = y; + type = t; + + /*VILLAGE*/ + if(type == -1){ + width = 4 * HLINE; + height = 4 * HLINE; + + for(int i = 0;i<10;i++){ + entnpc[i] = &npc[i]; + npc[i].type = -1; //this will make the NPC spawn the start of a village + entnpc[i]->spawn(loc.x + (float)(i - 5) / 8,0); //this will spawn the start of a village + } + } } |