nolok can be killed with fireballs now
authorMarek Moeckel <wansti@gmx.de>
Mon, 4 Apr 2005 17:52:48 +0000 (17:52 +0000)
committerMarek Moeckel <wansti@gmx.de>
Mon, 4 Apr 2005 17:52:48 +0000 (17:52 +0000)
SVN-Revision: 2336

src/badguy/nolok_01.cpp
src/badguy/nolok_01.h

index 7d66504..65abc95 100644 (file)
@@ -12,7 +12,6 @@
 static const float WALKSPEED = 90;
 
 //TODO: Create sprite, limit max number of snowballs
-//      Stop actions when pause button is hit (probably a general problem of timers)
 Nolok_01::Nolok_01(const lisp::Lisp& reader)
 {
   reader.get("x", start_position.x);
@@ -113,4 +112,19 @@ Nolok_01::collision_solid(GameObject& , const CollisionHit& hit)
   return CONTINUE;
 }
 
+//TODO: Hitpoint count incorrect when combining squishing and shooting
+void
+Nolok_01::kill_fall()
+{
+  if (hitpoints <= 0) {
+   SoundManager::get()->play_sound(IDToSound(SND_FALL), this,
+         Sector::current()->player->get_pos());
+   physic.set_velocity_y(0);
+   physic.enable_gravity(true);
+   set_state(STATE_FALLING);
+   Sector::current()->add_object(new Door((int)get_pos().x+32, 512, "sector1", "main2"));
+  }
+  else {hitpoints--;}
+}
+
 IMPLEMENT_FACTORY(Nolok_01, "nolok_01")
index cc50d5a..f02c754 100644 (file)
@@ -13,6 +13,7 @@ public:
   void activate();
   void write(lisp::Writer& writer);
   void active_action(float elapsed_time);
+  void kill_fall();
   HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
   
 protected: