{
float scroll_x = World::current()->displaymanager
.get_viewport().get_translation().x;
+ float scroll_y = World::current()->displaymanager
+ .get_viewport().get_translation().y;
// Remove if it's far off the screen:
- if (base.x < scroll_x - OFFSCREEN_DISTANCE)
+ if (base.x < scroll_x - X_OFFSCREEN_DISTANCE)
{
remove_me();
return;
}
// Once it's on screen, it's activated!
- if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE)
+ if (base.x > scroll_x - X_OFFSCREEN_DISTANCE &&
+ base.x < scroll_x + screen->w + X_OFFSCREEN_DISTANCE &&
+ base.y > scroll_y - Y_OFFSCREEN_DISTANCE &&
+ base.y < scroll_y + screen->h + Y_OFFSCREEN_DISTANCE)
seen = true;
if(!seen)
/* Size constraints: */
-#define OFFSCREEN_DISTANCE 256
+#define X_OFFSCREEN_DISTANCE 280
+#define Y_OFFSCREEN_DISTANCE 240
#define LEVEL_WIDTH 375
World::current()->displaymanager.get_viewport().get_translation().x;
float scroll_y =
World::current()->displaymanager.get_viewport().get_translation().y;
- if(base.x < scroll_x - OFFSCREEN_DISTANCE
- || base.y < scroll_y - OFFSCREEN_DISTANCE) {
- remove_me();
- return;
- }
- if(base.y > scroll_y + screen->h) {
+
+ if(base.x < scroll_x - X_OFFSCREEN_DISTANCE ||
+ base.x > scroll_x + screen->w + X_OFFSCREEN_DISTANCE ||
+ base.y < scroll_y - Y_OFFSCREEN_DISTANCE ||
+ base.y > scroll_y + screen->h + Y_OFFSCREEN_DISTANCE)
+ {
remove_me();
return;
- }
+ }
/* Move around? */
physic.apply(elapsed_time, base.x, base.y);