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 texture_type img_bsod_left[4];
25 extern texture_type img_bsod_right[4];
26 extern texture_type img_laptop_left[3];
27 extern texture_type 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 texture_type* texture_left;
103 texture_type* texture_right;
104 int animation_offset;
105 size_t animation_length;
106 float animation_speed;
109 void init(float x, float y, BadGuyKind kind);
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.
124 void action_laptop();
127 void action_mrbomb();
128 void action_stalactite();
131 void action_bouncingsnowball();
132 void action_flyingsnowball();
134 void action_snowball();
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(texture_type* left, texture_type* right,
158 int animlength = 1, float animspeed = 1);
161 #endif /*SUPERTUX_BADGUY_H*/