From 7becc3ff0c1c8b4c9a2bdb12bfc085925c8702f1 Mon Sep 17 00:00:00 2001 From: mathnerd314 Date: Sat, 13 Feb 2010 03:43:44 +0000 Subject: [PATCH] Some Yeti boss work. Yes, you *can* beat it as small tux. (And the secret area *is* also reachable if you're inhumanly precise) git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6328 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- data/levels/world1/27 - No More Mr Ice Guy.stl | 236 +++++++++++++------------ src/badguy/badguy.hpp | 4 + src/badguy/stalactite.cpp | 10 +- src/badguy/yeti.cpp | 59 ++++--- src/badguy/yeti.hpp | 1 - src/badguy/yeti_stalactite.cpp | 18 ++ src/badguy/yeti_stalactite.hpp | 1 + 7 files changed, 180 insertions(+), 149 deletions(-) diff --git a/data/levels/world1/27 - No More Mr Ice Guy.stl b/data/levels/world1/27 - No More Mr Ice Guy.stl index b188184c1..0aed58823 100644 --- a/data/levels/world1/27 - No More Mr Ice Guy.stl +++ b/data/levels/world1/27 - No More Mr Ice Guy.stl @@ -17,6 +17,13 @@ Effect.fade_in(1); (camera (mode "normal") ) + (secretarea + (fade-tilemap "Secret") + (width 1032) + (height 264) + (x 180) + (y 20) + ) (particles-snow ) (spawnpoint @@ -25,169 +32,172 @@ Effect.fade_in(1); (y 448) ) (yeti_stalactite - (x 97) - (y 32) - ) - (yeti_stalactite - (x 128) - (y 32) + (x 256) + (y 324) ) (yeti_stalactite - (x 161) - (y 32) + (x 287) + (y 324) ) (yeti_stalactite - (x 191) - (y 32) + (x 320) + (y 324) ) (yeti_stalactite - (x 223) - (y 32) + (x 350) + (y 324) ) (yeti_stalactite - (x 255) - (y 32) + (x 382) + (y 324) ) (yeti_stalactite - (x 288) - (y 32) + (x 414) + (y 324) ) (yeti_stalactite - (x 321) - (y 32) + (x 447) + (y 324) ) (yeti_stalactite - (x 352) - (y 32) + (x 480) + (y 324) ) (yeti_stalactite - (x 384) - (y 32) + (x 511) + (y 324) ) (yeti_stalactite - (x 417) - (y 32) + (x 543) + (y 324) ) (yeti_stalactite (x 576) - (y 32) + (y 324) ) (yeti_stalactite - (x 545) - (y 32) + (x 735) + (y 324) ) (yeti_stalactite - (x 512) - (y 32) + (x 704) + (y 324) ) (yeti_stalactite - (x 479) - (y 32) + (x 671) + (y 324) ) (yeti_stalactite - (x 448) - (y 32) + (x 638) + (y 324) ) (yeti_stalactite (x 607) - (y 32) + (y 324) ) (yeti_stalactite - (x 639) - (y 32) + (x 766) + (y 324) ) (yeti_stalactite - (x 671) - (y 32) + (x 798) + (y 324) ) - (tilemap - (z-pos -100) - (solid #f) - (width 25) - (height 20) - (tiles - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - ) + (yeti_stalactite + (x 830) + (y 324) + ) + (yeti_stalactite + (x 864) + (y 324) + ) + (yeti_stalactite + (x 896) + (y 324) + ) + (yeti_stalactite + (x 928) + (y 324) + ) + (yeti_stalactite + (x 960) + (y 324) + ) + (yeti_stalactite + (x 992) + (y 324) ) (tilemap - (z-pos 0) (solid #t) - (width 25) - (height 20) + (z-pos 0) + (width 40) + (height 25) (tiles - 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 - 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 8 8 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 8 - 14 14 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 14 - 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 - 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 - 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 - 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 - 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 - 11 11 21 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 22 11 11 - 11 11 20 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 23 11 11 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 102 104 104 128 104 104 128 0 0 0 0 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 0 0 0 44 44 44 44 44 44 44 0 0 0 0 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 21 8 8 8 8 8 8 8 8 8 8 8 8 8 9 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 20 14 14 14 14 14 14 14 14 14 14 14 14 14 15 0 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 21 9 0 10 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 20 15 0 10 11 12 + 16 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 18 0 16 17 18 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 7 8 8 8 8 8 8 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 8 8 8 8 8 9 + 13 14 14 14 14 14 14 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 14 14 14 14 14 15 + 10 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 21 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 22 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 20 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 23 11 11 11 11 11 11 12 + 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 ) ) (tilemap - (z-pos 100) (solid #f) - (width 25) - (height 20) + (z-pos 1) + (name "Secret") + (width 40) + (height 25) (tiles - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 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0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) ) (yeti (dead-script "sector.Tux.trigger_sequence(\"fireworks\");") - (x 2) - (y 177) + (x 17) + (y 396) ) ) ) diff --git a/src/badguy/badguy.hpp b/src/badguy/badguy.hpp index b6aa07516..bda8d053d 100644 --- a/src/badguy/badguy.hpp +++ b/src/badguy/badguy.hpp @@ -146,6 +146,10 @@ protected: State get_state() const { return state; } + bool check_state_timer() { + return state_timer.check(); + } + /** returns a pointer to the nearest player or 0 if no player is available */ Player* get_nearest_player(); diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index 20eea8c59..449b59264 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -69,6 +69,7 @@ Stalactite::squish() physic.set_velocity_x(0); physic.set_velocity_y(0); set_state(STATE_SQUISHED); + sprite->set_action("squished"); set_group(COLGROUP_MOVING_ONLY_STATIC); run_dead_script(); } @@ -110,8 +111,6 @@ Stalactite::collision_badguy(BadGuy& other, const CollisionHit& hit) other.kill_fall(); } - remove_me(); - return FORCE_MOVE; } @@ -123,15 +122,12 @@ Stalactite::kill_fall() void Stalactite::draw(DrawingContext& context) { - if(get_state() != STATE_ACTIVE) + if(get_state() == STATE_INIT || get_state() == STATE_INACTIVE) return; if(state == STALACTITE_SQUISHED) { sprite->draw(context, get_pos(), LAYER_OBJECTS); - return; - } - - if(state == STALACTITE_SHAKING) { + } else if(state == STALACTITE_SHAKING) { sprite->draw(context, get_pos() + shake_delta, layer); } else { sprite->draw(context, get_pos(), layer); diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index 6249ea916..7e6c83c55 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -36,17 +36,17 @@ const float JUMP_DOWN_VY = -250; /**< vertical speed while jumping off the dais const float RUN_VX = 350; /**< horizontal speed while running */ const float JUMP_UP_VX = 350; /**< horizontal speed while jumping on the dais */ -const float JUMP_UP_VY = -800; /**< vertical speed while jumping on the dais */ +const float JUMP_UP_VY = -700; /**< vertical speed while jumping on the dais */ -const float STOMP_VY = -250; /** vertical speed while stomping on the dais */ +const float STOMP_VY = -300; /** vertical speed while stomping on the dais */ -const float LEFT_STAND_X = 16; /**< x-coordinate of left dais' end position */ -const float RIGHT_STAND_X = 800-60-16; /**< x-coordinate of right dais' end position */ -const float LEFT_JUMP_X = LEFT_STAND_X+224; /**< x-coordinate of from where to jump on the left dais */ -const float RIGHT_JUMP_X = RIGHT_STAND_X-224; /**< x-coordinate of from where to jump on the right dais */ +const float LEFT_STAND_X = 80; /**< x-coordinate of left dais' end position */ +const float RIGHT_STAND_X = 1280-LEFT_STAND_X-60; /**< x-coordinate of right dais' end position */ +const float LEFT_JUMP_X = LEFT_STAND_X+448; /**< x-coordinate of from where to jump on the left dais */ +const float RIGHT_JUMP_X = RIGHT_STAND_X-448; /**< x-coordinate of from where to jump on the right dais */ const float STOMP_WAIT = .5; /**< time we stay on the dais before jumping again */ const float SAFE_TIME = .5; /**< the time we are safe when tux just hit us */ -const int INITIAL_HITPOINTS = 3; /**< number of hits we can take */ +const int INITIAL_HITPOINTS = 9; /**< number of hits we can take */ const float YETI_SQUISH_TIME = 5; } @@ -172,23 +172,16 @@ void Yeti::be_angry() { //turn around - dir = (dir==RIGHT)?LEFT:RIGHT; + dir = (dir==RIGHT) ? LEFT : RIGHT; - sprite->set_action((dir==RIGHT)?"stand-right":"stand-left"); + sprite->set_action((dir==RIGHT) ? "stand-right" : "stand-left"); physic.set_velocity_x(0); physic.set_velocity_y(0); - if (hit_points < INITIAL_HITPOINTS) summon_snowball(); stomp_count = 0; state = BE_ANGRY; state_timer.start(STOMP_WAIT); } -void -Yeti::summon_snowball() -{ - Sector::current()->add_object(new BouncingSnowball(Vector(get_pos().x+(dir == RIGHT ? 64 : -64), get_pos().y), dir)); -} - bool Yeti::collision_squished(GameObject& object) { @@ -237,7 +230,6 @@ void Yeti::kill_fall() { // shooting bullets or being invincible won't work :) - //take_hit(*get_nearest_player()); // FIXME: debug only(?) } void @@ -246,9 +238,6 @@ Yeti::drop_stalactite() // make a stalactite falling down and shake camera a bit Sector::current()->camera->shake(.1f, 0, 10); - YetiStalactite* nearest = 0; - float dist = FLT_MAX; - Player* player = this->get_nearest_player(); if (!player) return; @@ -257,17 +246,31 @@ Yeti::drop_stalactite() i != sector->gameobjects.end(); ++i) { YetiStalactite* stalactite = dynamic_cast (*i); if(stalactite && stalactite->is_hanging()) { - float sdist - = fabsf(stalactite->get_pos().x - player->get_pos().x); - if(sdist < dist) { - nearest = stalactite; - dist = sdist; + float distancex; + switch (hit_points) { + case 9: + case 8: + case 7: + case 6: + // drop stalactites within 3 of player, going out with each jump + distancex = fabsf(stalactite->get_bbox().get_middle().x - player->get_bbox().get_middle().x); + if(distancex < stomp_count*32) { + stalactite->start_shaking(); + } + break; + case 5: + case 4: + case 3: + case 2: + case 1: + // drop every 3rd stalactite + if(((((int)stalactite->get_pos().x + 16) / 32) % 3) == (stomp_count % 3)) { + stalactite->start_shaking(); + } + break; } } } - - if(nearest) - nearest->start_shaking(); } void diff --git a/src/badguy/yeti.hpp b/src/badguy/yeti.hpp index 326b263f6..573a7a030 100644 --- a/src/badguy/yeti.hpp +++ b/src/badguy/yeti.hpp @@ -41,7 +41,6 @@ private: void jump_up(); void be_angry(); void drop_stalactite(); - void summon_snowball(); void jump_down(); void draw_hit_points(DrawingContext& context); diff --git a/src/badguy/yeti_stalactite.cpp b/src/badguy/yeti_stalactite.cpp index 59d819bb5..8f6ef721d 100644 --- a/src/badguy/yeti_stalactite.cpp +++ b/src/badguy/yeti_stalactite.cpp @@ -16,6 +16,7 @@ #include "badguy/yeti_stalactite.hpp" +#include "sprite/sprite.hpp" #include "supertux/object_factory.hpp" static const float YT_SHAKE_TIME = .8f; @@ -51,4 +52,21 @@ YetiStalactite::active_update(float elapsed_time) 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 */ diff --git a/src/badguy/yeti_stalactite.hpp b/src/badguy/yeti_stalactite.hpp index ab620f530..48e38d003 100644 --- a/src/badguy/yeti_stalactite.hpp +++ b/src/badguy/yeti_stalactite.hpp @@ -28,6 +28,7 @@ public: void active_update(float elapsed_time); void start_shaking(); bool is_hanging(); + void update(float elapsed_time); }; #endif -- 2.11.0