Skip to content

Commit

Permalink
Snowman: Created body-only animation and added it to the squished col…
Browse files Browse the repository at this point in the history
…lision handler.

SVN-Revision: 6507
  • Loading branch information
Florian Forster committed Mar 2, 2010
1 parent 6f39d2b commit 52a3f84
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 9 deletions.
Binary file added data/images/creatures/snowman/headless1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/snowman/headless8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion data/images/creatures/snowman/snowman.sprite
Expand Up @@ -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 ;;
23 changes: 15 additions & 8 deletions src/badguy/snowman.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 52a3f84

Please sign in to comment.