}
Thunderstorm::Thunderstorm(const lisp::Lisp& reader)
- : running(true), interval(10.0f)
+ : running(true), interval(10.0f), layer(LAYER_BACKGROUNDTILES-1)
{
reader.get("name", name);
reader.get("running", running);
if(interval <= 0) {
log_warning << "Running a thunderstorm with non-positive time interval is a bad idea" << std::endl;
}
+ reader.get("layer", layer);
sound_manager->preload("sounds/explosion.wav");
sound_manager->preload("sounds/upgrade.wav");
float alpha = 0.33f;
context.push_transform();
context.set_translation(Vector(0, 0));
- context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(1, 1, 1, alpha), LAYER_BACKGROUNDTILES-1);
+ context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(1, 1, 1, alpha), layer);
context.pop_transform();
}
private:
bool running; /**< whether we currently automatically trigger lightnings */
float interval; /**< time between two lightnings */
+ int layer; /**< layer, where flash will be painted */
Timer time_to_thunder; /**< counts down until next thunder */
Timer time_to_lightning; /**< counts down until next lightning */