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"
25 extern Sprite* img_bsod_left;
26 extern Sprite* img_bsod_right;
27 extern Sprite* img_laptop_left;
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) {}
103 Sprite* sprite_right;
105 int animation_offset;
106 size_t animation_length;
107 float animation_speed;
110 void init(float x, float y, BadGuyKind kind);
112 void action(float frame_ratio);
115 void collision(void* p_c_object, int c_object,
116 CollisionType type = COLLISION_NORMAL);
118 /** this functions tries to kill the badguy and lets him fall off the
119 * screen. Some badguys like the flame might ignore this.
124 void action_bsod(float frame_ratio);
125 void action_laptop(float frame_ratio);
126 void action_money(float frame_ratio);
127 void action_bomb(float frame_ratio);
128 void action_mrbomb(float frame_ratio);
129 void action_stalactite(float frame_ratio);
130 void action_flame(float frame_ratio);
131 void action_fish(float frame_ratio);
132 void action_bouncingsnowball(float frame_ratio);
133 void action_flyingsnowball(float frame_ratio);
134 void action_spiky(float frame_ratio);
135 void action_snowball(float frame_ratio);
137 /** handles falling down. disables gravity calculation when we're back on
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 /** let the player jump a bit (used when you hit a badguy) */
146 void make_player_jump(Player* player);
147 /** check if we're running left or right in a wall and eventually change
150 void check_horizontal_bump(bool checkcliff = false);
151 /** called when we're bumped from below with a block */
153 /** called when a player jumped on the badguy from above */
154 void squish(Player* player);
155 /** squish ourself, give player score and set dying to DYING_SQICHED */
156 void squish_me(Player* player);
157 /** set image of the badguy */
158 void set_sprite(Sprite* left, Sprite* right,
159 int animlength = 1, float animspeed = 1);
162 #endif /*SUPERTUX_BADGUY_H*/