From: Florian Forster Date: Tue, 2 Mar 2010 09:01:38 +0000 (+0000) Subject: Snowman: Created body-only animation and added it to the squished collision handler. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=52a3f8441f744a7850f0235e30d32afbc7577e8a;p=supertux.git Snowman: Created body-only animation and added it to the squished collision handler. SVN-Revision: 6507 --- diff --git a/data/images/creatures/snowman/headless1.png b/data/images/creatures/snowman/headless1.png new file mode 100644 index 000000000..7503dea27 Binary files /dev/null and b/data/images/creatures/snowman/headless1.png differ diff --git a/data/images/creatures/snowman/headless2.png b/data/images/creatures/snowman/headless2.png new file mode 100644 index 000000000..cb3e0951e Binary files /dev/null and b/data/images/creatures/snowman/headless2.png differ diff --git a/data/images/creatures/snowman/headless3.png b/data/images/creatures/snowman/headless3.png new file mode 100644 index 000000000..f9341e999 Binary files /dev/null and b/data/images/creatures/snowman/headless3.png differ diff --git a/data/images/creatures/snowman/headless4.png b/data/images/creatures/snowman/headless4.png new file mode 100644 index 000000000..f4d23a82e Binary files /dev/null and b/data/images/creatures/snowman/headless4.png differ diff --git a/data/images/creatures/snowman/headless5.png b/data/images/creatures/snowman/headless5.png new file mode 100644 index 000000000..73702229e Binary files /dev/null and b/data/images/creatures/snowman/headless5.png differ diff --git a/data/images/creatures/snowman/headless6.png b/data/images/creatures/snowman/headless6.png new file mode 100644 index 000000000..a8b3e9d39 Binary files /dev/null and b/data/images/creatures/snowman/headless6.png differ diff --git a/data/images/creatures/snowman/headless7.png b/data/images/creatures/snowman/headless7.png new file mode 100644 index 000000000..d93f573e5 Binary files /dev/null and b/data/images/creatures/snowman/headless7.png differ diff --git a/data/images/creatures/snowman/headless8.png b/data/images/creatures/snowman/headless8.png new file mode 100644 index 000000000..5dea4f04f Binary files /dev/null and b/data/images/creatures/snowman/headless8.png differ diff --git a/data/images/creatures/snowman/snowman.sprite b/data/images/creatures/snowman/snowman.sprite index ade468031..570b6cef4 100644 --- a/data/images/creatures/snowman/snowman.sprite +++ b/data/images/creatures/snowman/snowman.sprite @@ -16,6 +16,26 @@ (name "walk-right") (hitbox 10 3 36 72) (mirror-action "walk-left") - )) + ) + + (action + (name "headless-left") + (fps 12.0) + (hitbox 7 8 47 50) + (images "headless1.png" + "headless2.png" + "headless3.png" + "headless4.png" + "headless5.png" + "headless6.png" + "headless7.png" + "headless8.png")) + + (action + (name "headless-right") + (hitbox 10 3 36 72) + (mirror-action "headless-left") + ) +) ;; EOF ;; diff --git a/src/badguy/snowman.cpp b/src/badguy/snowman.cpp index e35311328..4a3cc2cd5 100644 --- a/src/badguy/snowman.cpp +++ b/src/badguy/snowman.cpp @@ -41,17 +41,24 @@ Snowman::collision_squished(GameObject& object) snowball_pos.x += 5; snowball_pos.y += 1; + // bounce + Player* player = dynamic_cast(&object); + if (player) + player->bounce(*this); + + /* Create death animation for the (now headless) snowman. */ + set_action (dir == LEFT ? "headless-left" : "headless-right", /* loops = */ -1); + set_pos (get_pos () + Vector (-4.0, 19.0)); /* difference in the sprite offsets */ + physic.set_velocity_y(0); + physic.set_acceleration_y(0); + physic.enable_gravity(true); + set_state (STATE_FALLING); + + /* Create a new snowball where the snowman's head was */ + /* TODO: Pass on our "dead_script" to the snowball. */ SnowBall* snowball = new SnowBall(snowball_pos, dir); - remove_me(); Sector::current()->add_object(snowball); - // bounce - Player* player = dynamic_cast(&object); - if (player) player->bounce(*this); -/* - sprite->set_action(dir == LEFT ? "squished-left" : "squished-right"); - kill_squished(object); -*/ return true; }