Resolves issue 0000304: Blocks don't return to original positions
authorChristoph Sommer <mail@christoph-sommer.de>
Mon, 18 Feb 2008 19:17:06 +0000 (19:17 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Mon, 18 Feb 2008 19:17:06 +0000 (19:17 +0000)
SVN-Revision: 5329

src/object/block.cpp

index 2a0e2af..7d0b938 100644 (file)
@@ -52,7 +52,7 @@ static const float EPSILON = .0001f;
 static const float BUMP_ROTATION_ANGLE = 10;
 
 Block::Block(Sprite* newsprite)
-  : sprite(newsprite), bouncing(false), breaking(false), bounce_dir(0), bounce_offset(0)
+  : sprite(newsprite), bouncing(false), breaking(false), bounce_dir(0), bounce_offset(0), original_y(-1)
 {
   bbox.set_size(32, 32.1f);
   set_group(COLGROUP_STATIC);
@@ -131,7 +131,9 @@ Block::draw(DrawingContext& context)
 void
 Block::start_bounce(float center_of_hitter)
 {
-  original_y = bbox.p1.y;
+  if(original_y == -1){
+    original_y = bbox.p1.y;
+  }
   bouncing = true;
   bounce_dir = -BOUNCY_BRICK_SPEED;
   bounce_offset = 0;