aboutsummaryrefslogtreecommitdiffstats
path: root/src/mob.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-04-27 08:50:07 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-04-27 08:50:07 -0400
commit174bcd3a415c21fc2c59a3af1b6333faa78b37d0 (patch)
treed2f9c9fe8a79628fb95557acb2a0bc03aedb07e3 /src/mob.cpp
parent88c21e763178856aef0155595d49085919205951 (diff)
ui fixes, other stuff
Diffstat (limited to 'src/mob.cpp')
-rw-r--r--src/mob.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/mob.cpp b/src/mob.cpp
index ea97474..c783209 100644
--- a/src/mob.cpp
+++ b/src/mob.cpp
@@ -16,10 +16,11 @@ void Page::act(void)
{
if (player->loc.x > loc.x - 100 && player->loc.x < loc.x + 100 && isInside(ui::mouse) &&
(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT))) {
- std::cout << "Hey\n";
- ui::drawPage(pageTexPath);
- ui::waitForDialog();
- die();
+ std::thread([this](void){
+ ui::drawPage(pageTexPath);
+ ui::waitForDialog();
+ die();
+ }).detach();
}
}
@@ -132,7 +133,7 @@ Bird::Bird(void)
void Bird::act(void)
{
static bool direction = false;
- auto deltaTime = gtime::getDeltaTime();
+ auto deltaTime = game::time::getDeltaTime();
if (!--actCounter) {
actCounter = actCounterInitial;
direction ^= 1;
@@ -172,13 +173,20 @@ Trigger::Trigger(void)
width = HLINES(20);
height = 2000;
tex = new Texturec(0);
+ triggered = false;
}
void Trigger::act(void)
{
auto c = player->loc.x + player->width / 2;
- if (c > loc.x && c < loc.x + width) {
+ static bool running = false;
+
+ if (triggered) {
+ die();
+ } else if (!running && c > loc.x && c < loc.x + width) {
std::thread([&]{
+ running = true;
+
XMLDocument xml;
XMLElement *exml;
@@ -203,7 +211,9 @@ void Trigger::act(void)
}
ui::toggleBlackFast();
- die();
+
+ triggered = true;
+ running = false;
}).detach();
}
}