Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / object / magicblock.hpp
1 //  SuperTux - MagicBlock
2 //
3 //  Magic Blocks are tile-like game objects that are sensitive to
4 //  lighting conditions. They are rendered in a color and
5 //  will only be solid as long as light of the same color shines
6 //  on the block. The black block becomes solid, if any kind of
7 //  light is above MIN_INTENSITY.
8 //
9 //  Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
10 //
11 //  This program is free software: you can redistribute it and/or modify
12 //  it under the terms of the GNU General Public License as published by
13 //  the Free Software Foundation, either version 3 of the License, or
14 //  (at your option) any later version.
15 //
16 //  This program is distributed in the hope that it will be useful,
17 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 //  GNU General Public License for more details.
20 //
21 //  You should have received a copy of the GNU General Public License
22 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24 #ifndef HEADER_SUPERTUX_OBJECT_MAGICBLOCK_HPP
25 #define HEADER_SUPERTUX_OBJECT_MAGICBLOCK_HPP
26
27 #include "object/moving_sprite.hpp"
28
29 class MagicBlock: public MovingSprite
30 {
31 public:
32   MagicBlock(const Reader& reader);
33
34   bool collides(GameObject& other, const CollisionHit& hit);
35   HitResponse collision(GameObject& other, const CollisionHit& hit);
36   void update(float elapsed_time);
37   void draw(DrawingContext& context);
38
39 private:
40   bool is_solid;
41   float trigger_red;
42   float trigger_green;
43   float trigger_blue;
44   float solid_time;
45   float switch_delay; /**< seconds until switching solidity */
46   Color color;
47   Color light;
48   Vector center;
49   bool black;
50 };
51
52 #endif
53
54 /* EOF */