From 3ca25f16f12442ad698973cf3e282ae6a7f664c9 Mon Sep 17 00:00:00 2001 From: Marek Moeckel Date: Mon, 4 Apr 2005 17:52:48 +0000 Subject: [PATCH] nolok can be killed with fireballs now SVN-Revision: 2336 --- src/badguy/nolok_01.cpp | 16 +++++++++++++++- src/badguy/nolok_01.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/badguy/nolok_01.cpp b/src/badguy/nolok_01.cpp index 7d66504f9..65abc9531 100644 --- a/src/badguy/nolok_01.cpp +++ b/src/badguy/nolok_01.cpp @@ -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") diff --git a/src/badguy/nolok_01.h b/src/badguy/nolok_01.h index cc50d5a76..f02c754fb 100644 --- a/src/badguy/nolok_01.h +++ b/src/badguy/nolok_01.h @@ -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: -- 2.11.0