DartTrap::DartTrap(const Reader& reader) :
BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", LAYER_TILES-1),
- initial_delay(0),
- fire_delay(2),
- ammo(-1),
+ initial_delay(0),
+ fire_delay(2),
+ ammo(-1),
state(IDLE),
fire_timer()
{
reader.get("fire-delay", fire_delay);
reader.get("ammo", ammo);
countMe = false;
- sound_manager->preload("sounds/dartfire.wav");
- if (start_dir == AUTO) log_warning << "Setting a DartTrap's direction to AUTO is no good idea" << std::endl;
+ SoundManager::current()->preload("sounds/dartfire.wav");
+ if (start_dir == AUTO) { log_warning << "Setting a DartTrap's direction to AUTO is no good idea" << std::endl; }
state = IDLE;
set_colgroup_active(COLGROUP_DISABLED);
if (initial_delay == 0) initial_delay = 0.1f;
float py = get_pos().y;
py += MUZZLE_Y;
- sound_manager->play("sounds/dartfire.wav", get_pos());
- Sector::current()->add_object(new Dart(Vector(px, py), dir, this));
+ SoundManager::current()->play("sounds/dartfire.wav", get_pos());
+ Sector::current()->add_object(std::make_shared<Dart>(Vector(px, py), dir, this));
state = IDLE;
sprite->set_action(dir == LEFT ? "idle-left" : "idle-right");
}