--base.y;
}
- // just activate the badguy, since he might be on screen already. If not he
- // gets deactivated anyway
- activate(LEFT);
+ if(World::current()->camera) {
+ Vector scroll = World::current()->camera->get_translation();
+
+ if(start_position.x > scroll.x - X_OFFSCREEN_DISTANCE &&
+ start_position.x < scroll.x + screen->w + X_OFFSCREEN_DISTANCE &&
+ start_position.y > scroll.y - Y_OFFSCREEN_DISTANCE &&
+ start_position.y < scroll.y + screen->h + Y_OFFSCREEN_DISTANCE) {
+ activate(LEFT);
+ }
+ }
}
void
World* World::current_ = 0;
World::World(const std::string& filename, int level_nr)
+ : level(0), tux(0), background(0), camera(0)
{
// FIXME: Move this to action and draw and everywhere else where the
// world calls child functions
}
delete level;
+
+ current_ = 0;
}
void