#include "gameloop.h"
#include "display_manager.h"
#include "lispwriter.h"
+#include "camera.h"
Sprite* img_mriceblock_flat_left;
Sprite* img_mriceblock_flat_right;
check_horizontal_bump();
if(mode == KICK && changed != dir)
{
+ float scroll_x = World::current()->camera->get_translation().x;
+
/* handle stereo sound (number 10 should be tweaked...)*/
if (base.x < scroll_x + screen->w/2 - 10)
play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER);
dying = DYING_NOT; // now the bomb hurts
timer.start(EXPLODETIME);
+ float scroll_x = World::current()->camera->get_translation().x;
+
/* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates...
if (base.x < scroll_x + screen->w/2 - 10)
play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER);
void
BadGuy::action(float elapsed_time)
{
- // Remove if it's far off the screen:
- if (base.x < scroll_x - OFFSCREEN_DISTANCE)
- {
- remove_me();
- return;
- }
-
+ float scroll_x = World::current()->camera->get_translation().x;
+ float scroll_y = World::current()->camera->get_translation().y;
+
// BadGuy fall below the ground
if (base.y > World::current()->get_level()->height * 32) {
remove_me();
}
// 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)
}
void
-BadGuy::draw(ViewPort& viewport, int)
+BadGuy::draw(Camera& viewport, int)
{
float scroll_x = viewport.get_translation().x;
float scroll_y = viewport.get_translation().y;