Snowman: Created body-only animation and added it to the squished collision handler.
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Tue, 2 Mar 2010 09:01:38 +0000 (09:01 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Tue, 2 Mar 2010 09:01:38 +0000 (09:01 +0000)
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6507 837edb03-e0f3-0310-88ca-d4d4e8b29345

data/images/creatures/snowman/headless1.png [new file with mode: 0644]
data/images/creatures/snowman/headless2.png [new file with mode: 0644]
data/images/creatures/snowman/headless3.png [new file with mode: 0644]
data/images/creatures/snowman/headless4.png [new file with mode: 0644]
data/images/creatures/snowman/headless5.png [new file with mode: 0644]
data/images/creatures/snowman/headless6.png [new file with mode: 0644]
data/images/creatures/snowman/headless7.png [new file with mode: 0644]
data/images/creatures/snowman/headless8.png [new file with mode: 0644]
data/images/creatures/snowman/snowman.sprite
src/badguy/snowman.cpp

diff --git a/data/images/creatures/snowman/headless1.png b/data/images/creatures/snowman/headless1.png
new file mode 100644 (file)
index 0000000..7503dea
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 (file)
index 0000000..cb3e095
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 (file)
index 0000000..f9341e9
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 (file)
index 0000000..f4d23a8
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 (file)
index 0000000..7370222
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 (file)
index 0000000..a8b3e9d
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 (file)
index 0000000..d93f573
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 (file)
index 0000000..5dea4f0
Binary files /dev/null and b/data/images/creatures/snowman/headless8.png differ
index ade4680..570b6ce 100644 (file)
     (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 ;;
index e353113..4a3cc2c 100644 (file)
@@ -41,17 +41,24 @@ Snowman::collision_squished(GameObject& object)
   snowball_pos.x += 5;
   snowball_pos.y += 1;
 
+  // bounce
+  Player* player = dynamic_cast<Player*>(&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<Player*>(&object);
-  if (player) player->bounce(*this);
-/*
-  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
-  kill_squished(object);
-*/
   return true;
 }