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_money_left[2];
66 BadGuyKind badguykind_from_string(const std::string& str);
67 std::string badguykind_to_string(BadGuyKind kind);
68 void load_badguy_gfx();
69 void free_badguy_gfx();
77 BadGuyData(BadGuyKind kind_, int x_, int y_)
78 : kind(kind_), x(x_), y(y_) {}
81 : kind(BAD_BSOD), x(0), y(0) {}
102 Surface** texture_left;
103 Surface** texture_right;
104 int animation_offset;
105 size_t animation_length;
106 float animation_speed;
109 void init(float x, float y, BadGuyKind kind);
111 void action(float frame_ratio);
114 void collision(void* p_c_object, int c_object,
115 CollisionType type = COLLISION_NORMAL);
117 /** this functions tries to kill the badguy and lets him fall off the
118 * screen. Some badguys like the flame might ignore this.
123 void action_bsod(float frame_ratio);
124 void action_laptop(float frame_ratio);
125 void action_money(float frame_ratio);
126 void action_bomb(float frame_ratio);
127 void action_mrbomb(float frame_ratio);
128 void action_stalactite(float frame_ratio);
129 void action_flame(float frame_ratio);
130 void action_fish(float frame_ratio);
131 void action_bouncingsnowball(float frame_ratio);
132 void action_flyingsnowball(float frame_ratio);
133 void action_spiky(float frame_ratio);
134 void action_snowball(float frame_ratio);
136 /** handles falling down. disables gravity calculation when we're back on
139 /** remove ourself from the list of badguys. WARNING! This function will
140 * invalidate all members. So don't do anything else with member after calling
144 /** let the player jump a bit (used when you hit a badguy) */
145 void make_player_jump(Player* player);
146 /** check if we're running left or right in a wall and eventually change
149 void check_horizontal_bump(bool checkcliff = false);
150 /** called when we're bumped from below with a block */
152 /** called when a player jumped on the badguy from above */
153 void squish(Player* player);
154 /** squish ourself, give player score and set dying to DYING_SQICHED */
155 void squish_me(Player* player);
156 /** set image of the badguy */
157 void set_texture(Surface** left, Surface** right,
158 int animlength = 1, float animspeed = 1);
161 #endif /*SUPERTUX_BADGUY_H*/