From b474abf466009731ef0d7bbf4cb98896f213ffb4 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Mon, 26 Apr 2004 19:58:11 +0000 Subject: [PATCH] - 'nother badguy fix from MatzeB: -fixes the bumping problem for badguys -implements bill kendricks proposal about helding iceblock (if you hit another enemy while SVN-Revision: 763 --- src/badguy.cpp | 29 +++++++++++++++++++++-------- src/gameloop.cpp | 2 +- src/player.cpp | 3 ++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/badguy.cpp b/src/badguy.cpp index 0c9f9a168..0388a75ea 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -827,10 +827,11 @@ BadGuy::set_sprite(Sprite* left, Sprite* right) void BadGuy::bump() { - if(kind == BAD_BSOD || kind == BAD_LAPTOP || kind == BAD_MRBOMB - || kind == BAD_BOUNCINGSNOWBALL) { - kill_me(); - } + // these can't be bumped + if(kind == BAD_FLAME || kind == BAD_BOMB || kind == BAD_FISH) + return; + + kill_me(); } void @@ -941,10 +942,16 @@ BadGuy::kill_me() return; dying = DYING_FALLING; - if(kind == BAD_LAPTOP) + if(kind == BAD_LAPTOP) { set_sprite(img_laptop_falling_left, img_laptop_falling_right); - else if(kind == BAD_BSOD) + if(mode == HELD) { + mode = NORMAL; + Player& tux = *World::current()->get_tux(); + tux.holding_something = false; + } + } else if(kind == BAD_BSOD) { set_sprite(img_bsod_falling_left, img_bsod_falling_right); + } physic.enable_gravity(true); physic.set_velocity_y(0); @@ -988,10 +995,16 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) pbad_c = (BadGuy*) p_c_object; /* If we're a kicked mriceblock, kill any badguys we hit */ - if(kind == BAD_LAPTOP && mode == KICK && - pbad_c->kind != BAD_FLAME && pbad_c->kind != BAD_BOMB) + if(kind == BAD_LAPTOP && mode == KICK) + { + pbad_c->kill_me(); + } + + // a held mriceblock gets kills the enemy too but falls to ground then + else if(kind == BAD_LAPTOP && mode == HELD) { pbad_c->kill_me(); + kill_me(); } /* Kill badguys that run into exploding bomb */ diff --git a/src/gameloop.cpp b/src/gameloop.cpp index efc3c9405..ad6b880a5 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -415,7 +415,7 @@ GameSession::check_end_conditions() /* End of level? */ int endpos = (World::current()->get_level()->width-10) * 32; Tile* endtile = collision_goal(tux->base); - printf("EndTile: %p.\n", endtile); + //printf("EndTile: %p.\n", endtile); // fallback in case the other endpositions don't trigger if (tux->base.x >= endpos || (endtile && endtile->data >= 1) || (end_sequence && !endsequence_timer.check())) diff --git a/src/player.cpp b/src/player.cpp index 82fe8a5f7..6298cc556 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -596,7 +596,8 @@ Player::collision(void* p_c_object, int c_object) !safe_timer.started() && pbad_c->mode != BadGuy::HELD) { - if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN) + if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN + && !holding_something) { holding_something = true; pbad_c->mode = BadGuy::HELD; -- 2.11.0