From: Ricardo Cruz Date: Mon, 18 Oct 2004 21:41:17 +0000 (+0000) Subject: Made Jumy and Flying Snowball look at player. And maybe other stuff. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9545f941166fa0a5d0c2d40d6f33488a0619ed76;p=supertux.git Made Jumy and Flying Snowball look at player. And maybe other stuff. SVN-Revision: 2030 --- diff --git a/data/images/supertux.strf b/data/images/supertux.strf index d5fd2497c..ef84fdbc7 100644 --- a/data/images/supertux.strf +++ b/data/images/supertux.strf @@ -799,15 +799,15 @@ (y-offset 3) (mirror-action "left")) - (action (name "falling-right") + (action (name "falling-left") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-flat-right.png")) + (images "shared/mriceblock-flat-left.png")) - (action (name "falling-left") + (action (name "falling-right") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-flat-left.png")) + (mirror-action "falling-left")) (action (name "flat-left") (x-offset 2) @@ -853,20 +853,40 @@ (y-offset 8) (images "shared/jumpy-left-up-0.png")) (action + (name "right-up") + (x-offset 7) + (y-offset 8) + (mirror-action "left-up")) + (action (name "left-down") (x-offset 7) (y-offset 8) (images "shared/jumpy-left-down-0.png")) (action + (name "right-down") + (x-offset 7) + (y-offset 8) + (mirror-action "left-down")) + (action (name "left-middle") (x-offset 7) (y-offset 8) (images "shared/jumpy-left-middle-0.png")) (action + (name "right-middle") + (x-offset 7) + (y-offset 8) + (mirror-action "left-middle")) + (action (name "left-iced") (x-offset 7) (y-offset 8) - (images "shared/jumpy-iced-left-up-0.png"))) + (images "shared/jumpy-iced-left-up-0.png")) + (action + (name "right-iced") + (x-offset 7) + (y-offset 8) + (mirror-action "left-iced"))) (sprite (name "mrbomb") (action @@ -1003,17 +1023,27 @@ (sprite (name "flyingsnowball") (action - (name "normal") + (name "left") (x-offset 4) (y-offset 3) (images "shared/flyingsnowball-left-0.png" "shared/flyingsnowball-left-1.png")) + (action + (name "right") + (x-offset 4) + (y-offset 3) + (mirror-action "left")) (action - (name "squished") + (name "squished-left") + (x-offset 4) + (y-offset -12) + (images "shared/flyingsnowball-squished-left.png")) + (action + (name "squished-right") (x-offset 4) (y-offset -12) - (images "shared/flyingsnowball-squished-left.png"))) + (mirror-action "squished-left"))) (sprite (name "spiky") (action diff --git a/src/badguy.cpp b/src/badguy.cpp index eca1d24d5..b540a52ab 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -236,7 +236,7 @@ BadGuy::activate(Direction activation_dir) } else if (kind == BAD_MRICEBLOCK) { physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); } else if(kind == BAD_JUMPY) { - set_action("left-up", "left-up"); + set_action("left-up", "right-up"); } else if(kind == BAD_BOMB) { set_action("ticking-left", "ticking-right"); // hack so that the bomb doesn't hurt until it expldes... @@ -257,7 +257,6 @@ BadGuy::activate(Direction activation_dir) set_action("normal", "normal"); physic.enable_gravity(true); } else if(kind == BAD_FLYINGSNOWBALL) { - set_action("normal", "normal"); physic.enable_gravity(false); } else if(kind == BAD_SPIKY) { physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); @@ -473,7 +472,7 @@ BadGuy::action_jumpy(double elapsed_time) { if(frozen_timer.check()) { - set_action("left-iced", "left-iced"); + set_action("left-iced", "right-iced"); return; } @@ -481,11 +480,11 @@ BadGuy::action_jumpy(double elapsed_time) // XXX: These tests *should* use location from ground, not velocity if (fabsf(vy) > 5.6f) - set_action("left-down", "left-down"); + set_action("left-down", "right-down"); else if (fabsf(vy) > 5.3f) - set_action("left-middle", "left-middle"); + set_action("left-middle", "right-middle"); else - set_action("left-up", "left-up"); + set_action("left-up", "right-up"); Player& tux = *Sector::current()->player; @@ -728,6 +727,12 @@ BadGuy::action_flyingsnowball(double elapsed_time) if(dying == DYING_NOT || dying == DYING_SQUISHED) collision_swept_object_map(&old_base, &base); + // set direction based on tux + if(Sector::current()->player->base.x > base.x) + dir = RIGHT; + else + dir = LEFT; + // Handle dying timer: if (dying == DYING_SQUISHED && !timer.check()) remove_me(); @@ -972,8 +977,6 @@ BadGuy::set_action(std::string left, std::string right) action_left = left; action_right = right; -std::cerr << "set_action(" << left << ", " << right << ") of " << badguykind_to_string(kind) << std::endl; - #if 0 if (1) { @@ -1112,7 +1115,7 @@ BadGuy::squish(Player* player) return; } else if(kind == BAD_FLYINGSNOWBALL) { squish_me(player); - set_action("squished", "squished"); + set_action("squished-left", "squished-right"); return; } else if(kind == BAD_SNOWBALL) { squish_me(player); @@ -1186,6 +1189,7 @@ BadGuy::explode(bool right_way) { badguy->timer.start(0); badguy->mode = BOMB_TICKING; + badguy->dir = dir; } remove_me();