3 // SuperTux - A Jump'n Run
4 // Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef SUPERTUX_PLAYER_H
21 #define SUPERTUX_PLAYER_H
27 #include "screen/texture.h"
28 #include "collision.h"
30 #include "moving_object.h"
35 #define TUX_SAFE_TIME 1250
36 #define TUX_INVINCIBLE_TIME 10000
37 #define TUX_INVINCIBLE_TIME_WARNING 2000
38 #define TIME_WARNING 20000 /* When to alert player they're low on time! */
42 #define DISTROS_LIFEUP 100
47 #define SCORE_DISTRO 25
64 extern PlayerKeymap keymap;
66 struct player_input_type
78 void player_input_init(player_input_type* pplayer_input);
83 extern Surface* tux_life;
85 extern Sprite* smalltux_gameover;
86 extern Sprite* smalltux_star;
87 extern Sprite* largetux_star;
88 extern Sprite* growingtux_left;
89 extern Sprite* growingtux_right;
109 extern PlayerSprite smalltux;
110 extern PlayerSprite largetux;
111 extern PlayerSprite firetux;
112 extern PlayerSprite icetux;
114 class Player : public MovingObject
117 enum HurtMode { KILL, SHRINK };
118 enum Power { NONE_POWER, FIRE_POWER, ICE_POWER };
119 enum FallMode { ON_GROUND, JUMPING, TRAMPOLINE_JUMP, FALLING };
121 player_input_type input;
125 bool holding_something;
141 base_type previous_base;
142 Timer invincible_timer;
143 Timer skidding_timer;
147 Timer shooting_timer; // used to show the arm when Tux is shooting
156 int key_event(SDLKey key, int state);
161 virtual void action(float elapsed_time);
162 virtual void draw(DrawingContext& context);
163 virtual void collision(const MovingObject& other_object,
166 void collision(void* p_c_object, int c_object);
167 void kill(HurtMode mode);
168 void player_remove_powerups();
169 void check_bounds(Camera* camera);
172 bool tiles_on_air(int tiles);
173 void grow(bool animate);
174 void move(const Vector& vector);
181 void handle_horizontal_input();
182 void handle_vertical_input();
183 void remove_powerups();
186 #endif /*SUPERTUX_PLAYER_H*/
188 /* Local Variables: */