if(flip_levels_mode)
flip_level = true;
+ last_swap_point = Vector(-1, -1);
+ last_swap_stats.reset();
+
restart_level();
}
if(flip_level)
level->do_vertical_flip();
+ global_stats.reset();
+ global_stats.set_total_points(COINS_COLLECTED_STAT, level->get_total_coins());
+ global_stats.set_total_points(BADGUYS_KILLED_STAT, level->get_total_badguys());
+ global_stats.set_total_points(TIME_NEEDED_STAT, level->time_left);
+
currentsector = level->get_sector("main");
if(!currentsector)
Termination::abort("Level has no main sector.", "");
if(tux_pos.x != -1)
{
tux_pos = currentsector->get_best_spawn_point(tux_pos);
+
+ if(last_swap_point.x > tux_pos.x)
+ tux_pos = last_swap_point;
+ else // new swap point
+ {
+ last_swap_point = tux_pos;
+
+ last_swap_stats += global_stats;
+ }
+
currentsector->player->base.x = tux_pos.x;
currentsector->player->base.y = tux_pos.y;
-
+
// has to reset camera on swapping
currentsector->camera->reset(Vector(currentsector->player->base.x,
currentsector->player->base.y));
levelintro();
}
- global_stats.reset();
-
time_left.init(true);
start_timers();
currentsector->play_music(LEVEL_MUSIC);
last_keys.clear();
}
if(compare_last(last_keys, "kill"))
- { // kill Tux
+ { // kill Tux, but without losing a life
+ player_status.lives++;
tux.kill(tux.KILL);
last_keys.clear();
}
if(end_sequence && !endsequence_timer.check())
{
exit_status = ES_LEVEL_FINISHED;
+ global_stats += last_swap_stats; // add swap points stats
return;
}
else if(end_sequence == ENDSEQUENCE_RUNNING && endtile && endtile->data >= 1)