// $Id$
//
// DartTrap - Shoots a Dart at regular intervals
-// Copyright (C) 2006 Christoph Sommer <supertux@2006.expires.deltadevelopment.de>
+// Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
#include "dart.hpp"
namespace {
- const float MUZZLE_Y = 28; /**< [px] muzzle y-offset from top */
+ const float MUZZLE_Y = 25; /**< [px] muzzle y-offset from top */
}
DartTrap::DartTrap(const lisp::Lisp& reader)
- : BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", LAYER_TILES-1), initial_delay(0), fire_delay(2), ammo(-1), state(IDLE)
+ : BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", LAYER_TILES-1), initial_delay(0), fire_delay(2), ammo(-1), state(IDLE)
{
reader.get("initial-delay", initial_delay);
reader.get("fire-delay", fire_delay);
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;
+ state = IDLE;
+ set_colgroup_active(COLGROUP_DISABLED);
+ if (initial_delay == 0) initial_delay = 0.1f;
}
void
}
void
-DartTrap::activate()
+DartTrap::initialize()
{
- state = IDLE;
sprite->set_action(dir == LEFT ? "idle-left" : "idle-right");
- set_group(COLGROUP_DISABLED);
+}
- if (initial_delay == 0) initial_delay = 0.1f;
+void
+DartTrap::activate()
+{
fire_timer.start(initial_delay);
}