{
if (!running) return;
- time_left = std::max(time_left - elapsed_time, 0.0f);
+ int prev_time = (int) floor(time_left*5);
+ time_left -= elapsed_time;
if(time_left <= 0) {
- Sector::current()->player->kill(true);
- stop();
+ if(time_left <= -5 || !Sector::current()->player->get_coins())
+ {
+ Sector::current()->player->kill(true);
+ stop();
+ }
+ if(prev_time != (int) floor(time_left*5))
+ {
+ Sector::current()->player->add_coins(-1);
+ }
}
}
virtual bool add_bonus(const std::string& bonus);
virtual void add_coins(int count);
+ virtual int get_coins();
/**
* picks up a bonus, taking care not to pick up lesser bonus items than we already have