time_left = 100;
gravity = 10.;
back_scrolling = false;
+ hor_autoscroll_speed = 0;
bkgd_speed = 2;
bkgd_top.red = 0;
bkgd_top.green = 0;
back_scrolling = false;
reader.read_bool("back_scrolling", &back_scrolling);
+ hor_autoscroll_speed = 0;
+ reader.read_float("hor_autoscroll_speed", &hor_autoscroll_speed);
+
bkgd_speed = 2;
reader.read_int("bkgd_speed", &bkgd_speed);
fprintf(fi," (back_scrolling #t)\n");
else
fprintf(fi," (back_scrolling #f)\n");
+ fprintf(fi," (hor_autoscroll_speed %2.1f)\n", hor_autoscroll_speed);
fprintf(fi," (gravity %2.1f)\n", gravity);
fprintf(fi," (background-tm ");
int start_pos_y;
float gravity;
bool back_scrolling;
+ float hor_autoscroll_speed;
std::vector<BadGuyData> badguy_data;
#include "sprite.h"
#include "screen.h"
+#define AUTOSCROLL_DEAD_INTERVAL 300
+
Surface* tux_life;
Sprite* smalltux_gameover;
bool Player::is_dead()
{
- if(base.y > screen->h)
+ if(base.y > screen->h || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling
return true;
else
return false;
if(base.x < scroll_x) // can happen if back scrolling is disabled
base.x = scroll_x;
+
+ if(base.x == scroll_x)
+ if(issolid(base.x, base.y) || issolid(base.x, base.y+32))
+ kill(KILL);
+
+ if(base.x + base.width > scroll_x + screen->w)
+ base.x = scroll_x + screen->w - base.width;
+
+
}
// EOF //
/* This functions takes cares of the scrolling */
void World::scrolling(double frame_ratio)
{
+ if(level->hor_autoscroll_speed)
+ {
+ scroll_x += level->hor_autoscroll_speed * frame_ratio;
+ return;
+ }
+
int tux_pos_x = (int)(tux.base.x + (tux.base.width/2));
if (level->back_scrolling || debug_mode)