}
}
-void
-BadGuy::init(float x, float y, BadGuyKind kind_, bool stay_on_platform_)
+BadGuy::BadGuy(float x, float y, BadGuyKind kind_, bool stay_on_platform_)
+ : removable(false)
{
base.x = x;
base.y = y;
physic.enable_gravity(false);
set_sprite(img_flame, img_flame);
} else if(kind == BAD_BOUNCINGSNOWBALL) {
- physic.set_velocity(-BADGUY_WALK_SPEED, 0);
+ physic.set_velocity(-1.3, 0);
set_sprite(img_bouncingsnowball_left, img_bouncingsnowball_right);
} else if(kind == BAD_STALACTITE) {
physic.enable_gravity(false);
}
// if we're in a solid tile at start correct that now
- if(kind != BAD_FLAME && kind != BAD_FISH && collision_object_map(&base)) {
+ if(kind != BAD_FLAME && kind != BAD_FISH && collision_object_map(base)) {
printf("Warning: badguy started in wall!.\n");
- while(collision_object_map(&base))
+ while(collision_object_map(base))
--base.y;
}
}
base.x = tux.base.x - 16;
base.y = tux.base.y + tux.base.height/1.5 - base.height;
}
- if(collision_object_map(&base))
+ if(collision_object_map(base))
{
base.x = tux.base.x;
base.y = tux.base.y + tux.base.height/1.5 - base.height;
void
BadGuy::remove_me()
{
- for(std::vector<BadGuy>::iterator i = World::current()->bad_guys.begin();
- i != World::current()->bad_guys.end(); ++i)
- {
- if( & (*i) == this) {
- World::current()->bad_guys.erase(i);
- return;
- }
- }
+ removable = true;
}
void
set_sprite(img_mrbomb_explosion, img_mrbomb_explosion);
dying = DYING_NOT; // now the bomb hurts
timer.start(EXPLODETIME);
+
+ /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates...
+ if (base.x < scroll_x + screen->w/2 - 10)
+ play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER);
+ else if (base.x > scroll_x + screen->w/2 + 10)
+ play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER);
+ else
+ play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER);
+
} else if(mode == BOMB_EXPLODE) {
remove_me();
return;
World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier);
play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
player_status.score_multiplier++;
-
remove_me();
return;
bump();
return;
}
+
if(type == COLLISION_SQUISH) {
Player* player = static_cast<Player*>(p_c_object);
squish(player);