properly implement invisible blocks
[supertux.git] / src / object / block.h
1 #ifndef __BOX_H__
2 #define __BOX_H__
3
4 #include "special/moving_object.h"
5
6 namespace SuperTux {
7   class Sprite;
8 }
9 class Player;
10
11 using namespace SuperTux;
12
13 class Block : public MovingObject
14 {
15 public:
16   Block(const Vector& pos, Sprite* sprite);
17   ~Block();
18
19   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
20   virtual void action(float elapsed_time);
21   virtual void draw(DrawingContext& context);
22
23 protected:
24   virtual void hit(Player& player) = 0;
25   void start_bounce();
26
27   Sprite* sprite;
28   bool bouncing;
29   float bounce_dir;
30   float bounce_offset;
31   float original_y;
32 };
33
34 class BonusBlock : public Block
35 {
36 public:
37   BonusBlock(const Vector& pos, int data);
38
39 protected:
40   virtual void hit(Player& player);
41
42 private:
43   int data;
44 };
45
46 class Brick : public Block
47 {
48 public:
49   Brick(const Vector& pos, int data);
50
51 protected:
52   virtual void hit(Player& player);
53
54 private:
55   bool breakable;
56   int coin_counter;
57 };
58
59 #endif
60