aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-11-13 08:26:31 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-11-13 08:26:31 -0500
commit613ab3be6ee76595c04b89992e62c41b52bc1a2f (patch)
tree1265eeb4238d04e4a6bf95df439e61c348342eb0 /src/entities.cpp
parentac52ecab5df8382b51d48a9431f672bfc502a400 (diff)
Added object class, and added quest listing
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index b076684..a0005c3 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -6,6 +6,8 @@ extern unsigned int loops;
extern World *currentWorld;
+extern Player *player;
+
void Entity::spawn(float x, float y){ //spawns the entity you pass to it based off of coords and global entity settings
loc.x = x;
loc.y = y;
@@ -89,6 +91,18 @@ Mob::Mob(int sub){
inv = new Inventory(NPC_INV_SIZE);
}
+Object::Object(int id):ID(id){
+ type = OBJECTT;
+ alive = true;
+ near = false;
+ width = HLINE * 8;
+ height = HLINE * 8;
+
+ maxHealth = health = 1;
+ tex = new Texturec(1, "assets/items/ITEM_SWORD.png");
+}
+
+
void Entity::draw(void){ //draws the entities
glPushMatrix();
if(type==NPCT){
@@ -161,6 +175,8 @@ void Entity::draw(void){ //draws the entities
default:
break;
}
+ }else if(type == OBJECTT){
+ tex->bind(0);
}else{
tex->bind(0);
}
@@ -279,6 +295,11 @@ void NPC::interact(){ //have the npc's interact back to the player
}
}
+void Object::interact(){
+ this->alive = false;
+ player->inv->addItem((ITEM_ID)(ID), (char)1);
+}
+
/*
* This spawns the structures
*
@@ -359,4 +380,4 @@ void Mob::wander(int timeRun){
default:
break;
}
-}
+} \ No newline at end of file