Had a bit of time today and worked on supertux:
[supertux.git] / src / object / block.cpp
index ccede81..3bd3209 100644 (file)
 #include "flower.h"
 #include "oneup.h"
 #include "star.h"
+#include "player_status.h"
 #include "badguy/badguy.h"
 #include "coin.h"
+#include "object_factory.h"
 
 static const float BOUNCY_BRICK_MAX_OFFSET=8;
 static const float BOUNCY_BRICK_SPEED=90;
@@ -24,7 +26,7 @@ Block::Block(const Vector& pos, Sprite* newsprite)
   : sprite(newsprite), bouncing(false), bounce_dir(0), bounce_offset(0)
 {
   bbox.set_pos(pos);
-  bbox.set_size(32, 32);
+  bbox.set_size(32, 32.1);
   flags |= FLAG_SOLID;
   original_y = pos.y;
 }
@@ -87,6 +89,7 @@ Block::draw(DrawingContext& context)
 void
 Block::start_bounce()
 {
+  original_y = bbox.p1.y;
   bouncing = true;
   bounce_dir = -BOUNCY_BRICK_SPEED;
   bounce_offset = 0;
@@ -164,6 +167,8 @@ BonusBlock::try_open()
   sprite->set_action("empty");
 }
 
+//IMPLEMENT_FACTORY(BonusBlock, "bonusblock")
+
 //---------------------------------------------------------------------------
 
 Brick::Brick(const Vector& pos, int data)
@@ -222,3 +227,4 @@ Brick::try_break(bool playerhit)
   }
 }
 
+//IMPLEMENT_FACTORY(Brick, "brick")