-BouncyBrick::BouncyBrick(const Vector& pos)
- : position(pos), offset(0), offset_m(-BOUNCY_BRICK_SPEED),
- shape(Sector::current()->solids->get_tile_id_at(pos))
-{
- shape.hidden = true;
-}
-
-void
-BouncyBrick::action(float elapsed_time)
-{
- offset += offset_m * elapsed_time;
-
- /* Go back down? */
- if (offset < -BOUNCY_BRICK_MAX_OFFSET)
- offset_m = BOUNCY_BRICK_SPEED;
-
- /* Stop bouncing? */
- if (offset >= 0)
- {
- shape.hidden = false;
- remove_me();
- }
-}
-
-void
-BouncyBrick::draw(DrawingContext& context)
-{
- TileManager::instance()->
- draw_tile(context, shape.id, position + Vector(0, offset), LAYER_TILES+1);
-}