tux.kick_timer.start(KICKING_TIME);
set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5);
- play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_KICK], this);
}
}
check_horizontal_bump();
if(mode == KICK && changed != dir)
{
- float scroll_x = Sector::current()->camera->get_translation().x;
-
- /* handle stereo sound (number 10 should be tweaked...)*/
- if (base.x < scroll_x + screen->w/2 - 10)
- play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER);
- else if (base.x > scroll_x + screen->w/2 + 10)
- play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER);
- else
- play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_RICOCHET], get_pos());
}
}
dying = DYING_NOT; // now the bomb hurts
timer.start(EXPLODETIME);
- float scroll_x = Sector::current()->camera->get_translation().x;
-
- /* 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);
-
+ sound_manager->play_sound(sounds[SND_EXPLODE], this);
} else if(mode == BOMB_EXPLODE) {
remove_me();
return;
if(sprite == 0)
return;
- sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS);
-#if 0
- Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right;
if(dying == DYING_FALLING && physic.get_velocity_y() < 0)
- sprite->draw(viewport.world2screen(Vector(base.x, base.y)), SD_VERTICAL_FLIP);
+ sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS, VERTICAL_FLIP);
else
- sprite->draw(viewport.world2screen(Vector(base.x, base.y)));
-#endif
+ sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS);
- float scroll_x = context.get_translation().x;
- float scroll_y = context.get_translation().y;
if(debug_mode)
- fillrect(base.x - scroll_x, base.y - scroll_y, base.width, base.height, 75,0,75, 150);
+ context.draw_filled_rect(Vector(base.x, base.y),
+ Vector(base.width, base.height), Color(75,0,75, 150), LAYER_OBJECTS+1);
}
void
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
- play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
+
+ sound_manager->play_sound(sounds[SND_SQUISH], get_pos());
player_status.score_multiplier++;
dying = DYING_SQUISHED;
make_player_jump(player);
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
- play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_SQUISH], get_pos());
player_status.score_multiplier++;
return;
if (mode == NORMAL || mode == KICK)
{
/* Flatten! */
- play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_STOMP], get_pos());
mode = FLAT;
set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
physic.set_velocity_x(0);
timer.start(4000);
} else if (mode == FLAT) {
/* Kick! */
- play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_KICK], this);
if (player->base.x < base.x + (base.width/2)) {
physic.set_velocity_x(5);
score * player_status.score_multiplier);
/* Play death sound: */
- play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_FALL], this);
}
void
/* Get kicked if were flat */
if (mode == FLAT && !dying)
{
- play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_KICK], this);
// Hit from left side
if (player->base.x < base.x) {