7 // Author: Tobias Glaesser <tobi.web@gmx.de> (C) 2003
9 // Copyright: See COPYING file that comes with this distribution
13 #ifndef SUPERTUX_BADGUY_H
14 #define SUPERTUX_BADGUY_H
22 #include "collision.h"
24 extern Surface* img_bsod_left[4];
25 extern Surface* img_bsod_right[4];
26 extern Surface* img_laptop_left[4];
27 extern Surface* img_jumpy_left_up;
28 extern Surface* img_jumpy_left_down;
29 extern Surface* img_jumpy_left_middle;
68 BadGuyKind badguykind_from_string(const std::string& str);
69 std::string badguykind_to_string(BadGuyKind kind);
70 void load_badguy_gfx();
71 void free_badguy_gfx();
79 BadGuyData(BadGuyKind kind_, int x_, int y_)
80 : kind(kind_), x(x_), y(y_) {}
83 : kind(BAD_BSOD), x(0), y(0) {}
104 Surface** texture_left;
105 Surface** texture_right;
106 int animation_offset;
107 size_t animation_length;
108 float animation_speed;
111 void init(float x, float y, BadGuyKind kind);
113 void action(float frame_ratio);
116 void collision(void* p_c_object, int c_object,
117 CollisionType type = COLLISION_NORMAL);
119 /** this functions tries to kill the badguy and lets him fall off the
120 * screen. Some badguys like the flame might ignore this.
125 void action_bsod(float frame_ratio);
126 void action_laptop(float frame_ratio);
127 void action_money(float frame_ratio);
128 void action_bomb(float frame_ratio);
129 void action_mrbomb(float frame_ratio);
130 void action_stalactite(float frame_ratio);
131 void action_flame(float frame_ratio);
132 void action_fish(float frame_ratio);
133 void action_bouncingsnowball(float frame_ratio);
134 void action_flyingsnowball(float frame_ratio);
135 void action_spiky(float frame_ratio);
136 void action_snowball(float frame_ratio);
138 /** handles falling down. disables gravity calculation when we're back on
141 /** remove ourself from the list of badguys. WARNING! This function will
142 * invalidate all members. So don't do anything else with member after calling
146 /** let the player jump a bit (used when you hit a badguy) */
147 void make_player_jump(Player* player);
148 /** check if we're running left or right in a wall and eventually change
151 void check_horizontal_bump(bool checkcliff = false);
152 /** called when we're bumped from below with a block */
154 /** called when a player jumped on the badguy from above */
155 void squish(Player* player);
156 /** squish ourself, give player score and set dying to DYING_SQICHED */
157 void squish_me(Player* player);
158 /** set image of the badguy */
159 void set_texture(Surface** left, Surface** right,
160 int animlength = 1, float animspeed = 1);
163 #endif /*SUPERTUX_BADGUY_H*/