#include "badguy/yeti_stalactite.hpp"
+#include "sprite/sprite.hpp"
#include "supertux/object_factory.hpp"
-static const float SHAKE_TIME = .8f;
+static const float YT_SHAKE_TIME = .8f;
YetiStalactite::YetiStalactite(const Reader& lisp)
: Stalactite(lisp)
void
YetiStalactite::start_shaking()
{
- timer.start(SHAKE_TIME);
+ timer.start(YT_SHAKE_TIME);
state = STALACTITE_SHAKING;
+ if(((int)get_pos().x / 32) % 2 == 0) {
+ physic.set_velocity_y(100);
+ }
}
bool
Stalactite::active_update(elapsed_time);
}
+void
+YetiStalactite::update(float elapsed_time)
+{
+ // Respawn instead of removing once squished
+ if(get_state() == STATE_SQUISHED && check_state_timer()) {
+ set_state(STATE_ACTIVE);
+ state = STALACTITE_HANGING;
+ // Hopefully we shouldn't come into contact with anything...
+ sprite->set_action("normal");
+ set_pos(start_position);
+ set_colgroup_active(COLGROUP_TOUCHABLE);
+ }
+
+ // Call back to badguy to do normal stuff
+ BadGuy::update(elapsed_time);
+}
+
/* EOF */