supertux/src/badguy/crystallo.cpp: Use MovingSprite::set_action to change the sprite.
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Sat, 27 Feb 2010 19:29:21 +0000 (19:29 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Sat, 27 Feb 2010 19:29:21 +0000 (19:29 +0000)
This will account for a change in the hitbox when chaning the sprite. As a
result, the dead Crystallo no longer appears to be a few pixels within the tile
he was standing on.

git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6426 837edb03-e0f3-0310-88ca-d4d4e8b29345

src/badguy/crystallo.cpp

index 443478f..b3ae9d4 100644 (file)
@@ -19,6 +19,7 @@
 #include "sprite/sprite.hpp"
 #include "supertux/object_factory.hpp"
 #include "util/reader.hpp"
+#include "object/anchor_point.hpp"
 
 Crystallo::Crystallo(const Reader& reader) :
   WalkingBadguy(reader, "images/creatures/crystallo/crystallo.sprite", "left", "right"),
@@ -58,7 +59,7 @@ Crystallo::active_update(float elapsed_time)
 bool
 Crystallo::collision_squished(GameObject& object)
 {
-  sprite->set_action(dir == LEFT ? "shattered-left" : "shattered-right");
+  this->set_action(dir == LEFT ? "shattered-left" : "shattered-right", /* loops = */ -1, ANCHOR_BOTTOM);
   kill_squished(object);
   return true;
 }