Tux can peek to the left and to the right as far as the camera would move in best...
[supertux.git] / src / object / rock.cpp
index 2df1586..6ba11fc 100644 (file)
 #include <config.h>
 
 #include "rock.hpp"
-#include "sprite/sprite.hpp"
-#include "sprite/sprite_manager.hpp"
 #include "lisp/writer.hpp"
 #include "video/drawing_context.hpp"
 #include "resources.hpp"
 #include "object_factory.hpp"
 
 Rock::Rock(const lisp::Lisp& reader)
+       : MovingSprite(reader, "images/objects/rock/rock.sprite", LAYER_OBJECTS+1, COLGROUP_MOVING)
 {
-  reader.get("x", bbox.p1.x);
-  reader.get("y", bbox.p1.y);
-  bbox.set_size(31.8, 31.8);
-  sprite = sprite_manager->create("images/objects/rock/rock.sprite");
   grabbed = false;
   flags |= FLAG_SOLID | FLAG_PORTABLE;
-  set_group(COLGROUP_MOVING);
-}
-
-Rock::~Rock()
-{
-  delete sprite;
 }
 
 void
@@ -55,12 +44,6 @@ Rock::write(lisp::Writer& writer)
 }
 
 void
-Rock::draw(DrawingContext& context)
-{
-  sprite->draw(context, get_pos(), LAYER_OBJECTS+1);
-}
-
-void
 Rock::update(float elapsed_time)
 {
   if(!grabbed) {