diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-03-28 08:26:06 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-03-28 08:26:06 -0400 |
commit | 82c178d797b9a23c31d7dad1cc8cac29d27c6eb1 (patch) | |
tree | c96240b1cc6ab185cce1da3929a436cb8f8077bb /src/entities.cpp | |
parent | 38bf2365e31745a5d6bfcea8f547b6263017f113 (diff) |
Merchants have to stay inside the stalls
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index e97464e..5a92c48 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -31,7 +31,7 @@ const char *randomDialog[RAND_DIALOG_COUNT] = { "Frig.", "The sine of theta equals the opposite over the hypotenuese.", "Did you know the developers spelt brazier as brazzier.", - "My dad once said to me, \"Boy, you are in a game.\" I never knew what he meant by that." + "What's a bagel? I don't know because I'm mormon" }; void initEntity(){ @@ -171,6 +171,8 @@ Merchant::Merchant(){ //sets all of the Merchant specific traits on object creat trade.reserve(100); currTrade = 0; + inside = nullptr; + //tex = new Texturec(1,"assets/NPC.png"); //inv = new Inventory(NPC_INV_SIZE); //inv = new Inventory(1); @@ -183,7 +185,7 @@ Merchant::~Merchant(){ /*while(!aiFunc.empty()){ aiFunc.pop_back(); }*/ - + delete inside; //delete inv; //delete tex; //delete[] name; @@ -459,6 +461,29 @@ void NPC::interact(){ //have the npc's interact back to the player }).detach(); } +void Merchant::wander(int timeRun){ + static int direction; + if ( ticksToUse == 0 ) { + ticksToUse = timeRun; + + vel.x = .008 * HLINE; + direction = (getRand() % 3 - 1); + + if ( direction == 0 ) + ticksToUse *= 2; + + vel.x *= direction; + } + + if( vel.x < 0) + currentWorld->goWorldLeft( this ); + if(inside != nullptr){ + if(loc.x <= inside->loc.x)loc.x = inside->loc.x; + if(loc.x + width >= inside->loc.x + inside->width)loc.x = inside->loc.x + inside->width - width; + } + ticksToUse--; +} + void Merchant::interact(){ std::thread([this]{ ui::merchantBox(name, trade[currTrade], ":Accept:Good-Bye", false, "Welcome to Smithy\'s. Buy your sausages here you freaking meme lording screw-face"); |