Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / badguy / mriceblock.hpp
1 //  SuperTux
2 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 #ifndef HEADER_SUPERTUX_BADGUY_MRICEBLOCK_HPP
18 #define HEADER_SUPERTUX_BADGUY_MRICEBLOCK_HPP
19
20 #include "badguy/walking_badguy.hpp"
21 #include "object/portable.hpp"
22
23 class MrIceBlock : public WalkingBadguy, 
24                    public Portable
25 {
26 public:
27   MrIceBlock(const Reader& reader);
28   MrIceBlock(const Vector& pos, Direction d);
29
30   void initialize();
31   HitResponse collision(GameObject& object, const CollisionHit& hit);
32   void collision_solid(const CollisionHit& hit);
33   HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
34   HitResponse collision_player(Player& player, const CollisionHit& hit);
35
36   void active_update(float elapsed_time);
37
38   void grab(MovingObject& object, const Vector& pos, Direction dir);
39   void ungrab(MovingObject& object, Direction dir);
40   bool is_portable() const;
41
42   bool can_break();
43
44 protected:
45   enum IceState {
46     ICESTATE_NORMAL,
47     ICESTATE_FLAT,
48     ICESTATE_GRABBED,
49     ICESTATE_KICKED
50   };
51
52 protected:
53   bool collision_squished(GameObject& object);
54   void set_state(IceState state);
55
56 private:
57   IceState ice_state;
58   Timer nokick_timer;
59   Timer flat_timer;
60   int squishcount;
61 };
62
63 #endif
64
65 /* EOF */