From: Marek Moeckel Date: Tue, 5 Apr 2005 10:54:16 +0000 (+0000) Subject: dispenser can now drop random badguys X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f757002abffede462f3912a6b285fafe251503fb;p=supertux.git dispenser can now drop random badguys SVN-Revision: 2343 --- diff --git a/data/levels/test/enemy3.stl b/data/levels/test/enemy3.stl index 4b3b7a407..81dee9363 100644 --- a/data/levels/test/enemy3.stl +++ b/data/levels/test/enemy3.stl @@ -79,6 +79,7 @@ (mriceblock (x 439) (y 159) (stay-on-platform #t)) (mriceblock (x 479) (y 159) (stay-on-platform #f)) (trampoline (x 250) (y 150) (power 7.5)) + (dispenser (x 700) (y 100) (badguy "random") (cycle 2)) ) ) diff --git a/src/badguy/dispenser.cpp b/src/badguy/dispenser.cpp index 2ff06b83c..e3a95d05c 100644 --- a/src/badguy/dispenser.cpp +++ b/src/badguy/dispenser.cpp @@ -58,7 +58,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() { @@ -75,7 +76,16 @@ Dispenser::launch_badguy() else if (badguy == "mrrocket") Sector::current()->add_object(new MrRocket(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 MrRocket(get_pos().x, get_pos().y+32, dir)); break; + } + } } }