4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 // Copyright (C) 2004 Matthias Braun <matze@braunis.de>
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 #ifndef SUPERTUX_BADGUY_H
24 #define SUPERTUX_BADGUY_H
33 #include "collision.h"
36 extern Sprite* img_bsod_left;
37 extern Sprite* img_bsod_right;
38 extern Sprite* img_laptop_left;
56 BadGuyKind badguykind_from_string(const std::string& str);
57 std::string badguykind_to_string(BadGuyKind kind);
58 void load_badguy_gfx();
59 void free_badguy_gfx();
66 bool stay_on_platform;
68 BadGuyData(BadGuyKind kind_, int x_, int y_, bool stay_on_platform_)
69 : kind(kind_), x(x_), y(y_), stay_on_platform(stay_on_platform_) {}
72 : kind(BAD_BSOD), x(0), y(0), stay_on_platform(false) {}
107 /** If true the enemy will stay on its current platform, ie. if he
108 reaches the edge he will turn around and walk into the other
109 direction, if false the enemy will jump or walk of the edge */
110 bool stay_on_platform;
122 Sprite* sprite_right;
124 int animation_offset;
127 BadGuy(float x, float y, BadGuyKind kind, bool stay_on_platform);
129 void action(float frame_ratio);
132 void collision(void* p_c_object, int c_object,
133 CollisionType type = COLLISION_NORMAL);
135 /** this functions tries to kill the badguy and lets him fall off the
136 * screen. Some badguys like the flame might ignore this.
140 /** remove ourself from the list of badguys. WARNING! This function will
141 * invalidate all members. So don't do anything else with member after calling
145 bool is_removable() const { return removable; }
148 void action_bsod(float frame_ratio);
149 void action_laptop(float frame_ratio);
150 void action_money(float frame_ratio);
151 void action_bomb(float frame_ratio);
152 void action_mrbomb(float frame_ratio);
153 void action_stalactite(float frame_ratio);
154 void action_flame(float frame_ratio);
155 void action_fish(float frame_ratio);
156 void action_bouncingsnowball(float frame_ratio);
157 void action_flyingsnowball(float frame_ratio);
158 void action_spiky(float frame_ratio);
159 void action_snowball(float frame_ratio);
161 /** handles falling down. disables gravity calculation when we're back on
165 /** let the player jump a bit (used when you hit a badguy) */
166 void make_player_jump(Player* player);
168 /** check if we're running left or right in a wall and eventually change
171 void check_horizontal_bump(bool checkcliff = false);
172 /** called when we're bumped from below with a block */
174 /** called when a player jumped on the badguy from above */
175 void squish(Player* player);
176 /** squish ourself, give player score and set dying to DYING_SQICHED */
177 void squish_me(Player* player);
178 /** set image of the badguy */
179 void set_sprite(Sprite* left, Sprite* right);
182 #endif /*SUPERTUX_BADGUY_H*/
184 /* Local Variables: */