Magic Blocks. (DrawingContext::get_light is not working yet.)
[supertux.git] / src / object / firefly.cpp
index b9b7759..49299fb 100644 (file)
 #include "object/sprite_particle.hpp"
 
 Firefly::Firefly(const lisp::Lisp& lisp)
-       : MovingSprite(lisp, "images/objects/firefly/firefly.sprite", LAYER_TILES, COLGROUP_TOUCHABLE), activated(false)
+       : MovingSprite(lisp, "images/objects/resetpoints/default-resetpoint.sprite", LAYER_TILES, COLGROUP_TOUCHABLE), activated(false)
 {
+
+  if( !lisp.get( "sprite", sprite_name ) ){
+    return;
+  }
+  if( sprite_name == "" ){
+    sprite_name = "images/objects/resetpoints/default-resetpoint.sprite";
+    return;
+  }
+  //Replace sprite
+  sprite = sprite_manager->create( sprite_name );
+  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
 }
 
 void
@@ -49,7 +60,7 @@ Firefly::collision(GameObject& other, const CollisionHit& )
 {
   if(activated)
     return ABORT_MOVE;
-  
+
   Player* player = dynamic_cast<Player*> (&other);
   if(player) {
     activated = true;
@@ -70,7 +81,7 @@ Firefly::collision(GameObject& other, const CollisionHit& )
     GameSession::current()->set_reset_point(Sector::current()->get_name(),
         get_pos());
   }
-  
+
   return ABORT_MOVE;
 }