1 // SuperTux - A Jump'n Run
2 // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmail.com>
3 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef HEADER_SUPERTUX_WORLDMAP_TUX_HPP
19 #define HEADER_SUPERTUX_WORLDMAP_TUX_HPP
21 #include "worldmap/worldmap.hpp"
29 class Tux : public GameObject
32 Direction back_direction;
36 Controller* controller;
38 Direction input_direction;
41 /** Length by which tux is away from its current tile, length is in
42 input_direction direction */
50 bool canWalk(int tile_data, Direction dir); /**< check if we can leave a tile (with given "tile_data") in direction "dir" */
51 void updateInputDirection(); /**< if controller was pressed, update input_direction */
52 void tryStartWalking(); /**< try starting to walk in input_direction */
53 void tryContinueWalking(float elapsed_time); /**< try to continue walking in current direction */
56 Tux(WorldMap* worldmap_);
59 void setup(); /**< called prior to first update */
60 void draw(DrawingContext& context);
61 void update(float elapsed_time);
63 void set_direction(Direction dir);
65 void set_ghost_mode(bool enabled);
66 bool get_ghost_mode();
68 bool is_moving() const { return moving; }
70 Vector get_tile_pos() const { return tile_pos; }
71 void set_tile_pos(Vector p) { tile_pos = p; }
75 Tux& operator=(const Tux&);
78 } // namespace worldmap