diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-11-24 07:34:00 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-11-24 07:34:00 -0500 |
commit | 5c1be9978e4c9b18c400c051fc2b083a02b74b7a (patch) | |
tree | 2c8dbf3aea3539d2f4c6db3ef56eb1880fd14786 /src/entities.cpp | |
parent | 4bf3665158e71e9b20a2231428d42d400da8332f (diff) | |
parent | 19ef54b2c5ffcaefdce352c6f195a62c05c42767 (diff) |
Merge branch 'master' of https://github.com/tcsullivan/gamedev
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 67a564a..af32cd6 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -8,6 +8,8 @@ extern World *currentWorld; extern Player *player; +extern const char *itemName; + 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; @@ -98,7 +100,21 @@ Mob::Mob(int sub){ inv = new Inventory(NPC_INV_SIZE); } -Object::Object(int id):ID(id){ +Object::Object(int id):identifier(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"); + + questObject = false; + pickupDialog="\0"; +} + +Object::Object(int id, bool qo, char *pd):identifier(id),questObject(qo),pickupDialog(pd){ type = OBJECTT; alive = true; near = false; @@ -181,8 +197,6 @@ void Entity::draw(void){ //draws the entities tex->bind(0); break; } - }else if(type == OBJECTT){ - tex->bind(0); }else{ tex->bind(0); } @@ -301,9 +315,19 @@ void NPC::interact(){ //have the npc's interact back to the player } } +extern void waitForDialog(void); void Object::interact(){ - this->alive = false; - player->inv->addItem((ITEM_ID)(ID), (char)1); + if(questObject){ + char opt[]=":No:Yes"; + ui::dialogBox("You",opt,pickupDialog); + if(ui::dialogOptChosen == 1){ + this->alive = false; + player->inv->addItem((ITEM_ID)(identifier), (char)1); + } + }else{ + this->alive = false; + player->inv->addItem((ITEM_ID)(identifier), (char)1); + } } /* |