else if(physic.get_velocity_y() < -9)
physic.set_velocity_y(-9);
+ float scroll_x =
+ World::current()->camera->get_translation().x;
+ float scroll_y =
+ World::current()->camera->get_translation().y;
if (base.x < scroll_x ||
base.x > scroll_x + screen->w ||
- base.y > screen->h ||
+ base.y < scroll_y ||
+ base.y > scroll_y + screen->h ||
issolid(base.x + 4, base.y + 2) ||
issolid(base.x, base.y + 2) ||
life_count <= 0)
}
void
-Bullet::draw(ViewPort& viewport, int )
+Bullet::draw(Camera& viewport, int )
{
if(kind == FIRE_BULLET)
img_firebullet->draw(viewport.world2screen(Vector(base.x, base.y)));
}
/* Away from the screen? Kill it! */
- if(base.x < scroll_x - OFFSCREEN_DISTANCE) {
- remove_me();
- return;
- }
- if(base.y > screen->h) {
+ float scroll_x =
+ World::current()->camera->get_translation().x;
+ float scroll_y =
+ World::current()->camera->get_translation().y;
+
+ 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);
}
void
-Upgrade::draw(ViewPort& viewport, int)
+Upgrade::draw(Camera& viewport, int)
{
SDL_Rect dest;