X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbadguy%2Fdispenser.cpp;h=b72daae82849438817f8cc74d4ffe0da62604199;hb=c0093d25093395cb62fc2526ab42be65a9f015b8;hp=2ff06b83c5d6638abc54ac04968e933fccb23c65;hpb=bb5bf44283e1ca2a3cc306f557cef5dbc8c20a22;p=supertux.git diff --git a/src/badguy/dispenser.cpp b/src/badguy/dispenser.cpp index 2ff06b83c..b72daae82 100644 --- a/src/badguy/dispenser.cpp +++ b/src/badguy/dispenser.cpp @@ -1,3 +1,23 @@ +// $Id$ +// +// SuperTux +// Copyright (C) 2005 Matthias Braun +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. + #include #include "dispenser.h" @@ -6,6 +26,7 @@ #include "badguy/mrbomb.h" #include "badguy/mriceblock.h" #include "badguy/mrrocket.h" +#include "badguy/poisonivy.h" Dispenser::Dispenser(const lisp::Lisp& reader) { @@ -15,7 +36,10 @@ Dispenser::Dispenser(const lisp::Lisp& reader) reader.get("badguy", badguy); bbox.set_size(32, 32); sprite = sprite_manager->create("dispenser"); - sprite->set_action("working"); + if (badguy == "mrrocket") { + sprite->set_action(dir == LEFT ? "working-left" : "working-right"); + } + else {sprite->set_action("dropper");} } void @@ -42,7 +66,7 @@ bool Dispenser::collision_squished(Player& player) { //TODO: Should it act like a normal tile when killed? - sprite->set_action("broken"); + sprite->set_action(dir == LEFT ? "broken-left" : "broken-right"); dispense_timer.start(0); player.bounce(*this); kill_squished(player); @@ -58,7 +82,8 @@ Dispenser::active_action(float ) } //TODO: Add launching velocity to certain badguys -// Add randomizer (themed to match tileset) +// Add themed randomizer +// Fix initial direction (everyone but MrRocket walks the wrong direction) void Dispenser::launch_badguy() { @@ -72,10 +97,21 @@ Dispenser::launch_badguy() Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir)); else if (badguy == "mriceblock") Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir)); - else if (badguy == "mrrocket") - Sector::current()->add_object(new MrRocket(get_pos().x, get_pos().y+32, dir)); + else if (badguy == "mrrocket") { + Sector::current()->add_object(new MrRocket(get_pos().x+(dir == LEFT ? -32 : 32), get_pos().y, dir));} + else if (badguy == "poisonivy") + Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir)); else if (badguy == "random") - {} + { + switch (rand()%5) + { + case 0: Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y+32, dir)); break; + case 1: Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y+32, dir)); break; + case 2: Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir)); break; + case 3: Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir)); break; + case 4: Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir)); break; + } + } } }