Agrego sonidos.

master
Félix Arreola Rodríguez 2020-01-28 17:57:16 -06:00
parent b7eecc4800
commit 63f9fd9d09
14 changed files with 57 additions and 12 deletions

View File

@ -142,6 +142,16 @@ nobase_dist_gamedata_DATA = images/background.png \
images/intro_plataform.png \
images/left.png \
images/right.png \
sounds/truck_reverse.wav \
sounds/truck.wav \
sounds/toonhit.wav \
sounds/fish.wav \
sounds/vase.wav \
sounds/anvil.wav \
sounds/boing.wav \
sounds/bag_place.wav \
sounds/bag_land.wav \
sounds/splop.wav \
klickclack.ttf \
burbanks.ttf

BIN
data/burbanks.ttf 100644

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -345,13 +345,37 @@ const char *images_names[NUM_IMAGES] = {
};
enum {
SND_NONE,
SND_TRUCK_REVERSE,
SND_TRUCK,
SND_TOONHIT,
SND_FISH,
SND_VASE,
SND_ANVIL,
SND_SPLOP,
SND_BOING,
SND_BAG_PLACE,
SND_BAG_LAND,
NUM_SOUNDS
};
const char *sound_names[NUM_SOUNDS] = {
"sounds/none.wav",
"sounds/truck_reverse.wav",
"sounds/truck.wav",
"sounds/toonhit.wav",
"sounds/fish.wav",
"sounds/vase.wav",
"sounds/anvil.wav",
"sounds/splop.wav",
"sounds/boing.wav",
"sounds/bag_place.wav",
"sounds/bag_land.wav",
};
/* Para el motor de botones */
@ -1683,7 +1707,8 @@ int game_loop (void) {
snprintf (buffer, sizeof (buffer), "%d", score);
score_p = draw_text_with_shadow (ttf24_klickclack, 2, buffer, blanco, negro);
}
/* TODO: Sonido de poner bolsa */
if (use_sound) Mix_PlayChannel (-1, sounds[SND_BAG_PLACE], 0);
if (bag_stack == (nivel + 1) * 10) {
/* Activar la pantalla de next_level */
@ -1787,11 +1812,12 @@ int game_loop (void) {
k = COLLIDER_PENGUIN_1 + bags;
/* Reproducir el sonido de "Agarrar bolsa" */
if (use_sound) Mix_PlayChannel (-1, sounds[SND_BAG_LAND], 0);
if (bags >= 6) {
/* Esta bolsa crasheó al pingüino */
printf ("Penguin Crash\n");
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0);
if (vidas > 0) {
try_visible = TRUE;
printf ("Try again visible\n");
@ -1801,7 +1827,7 @@ int game_loop (void) {
SDL_FreeSurface (vidas_p);
snprintf (buffer, sizeof (buffer), "%d", vidas);
vidas_p = draw_text_with_shadow (ttf24_klickclack, 2, buffer, blanco, negro);
/* TODO: Reproducir aquí el sonido de golpe */
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0);
} else {
gameover_visible = TRUE;
printf ("Game Over visible\n");
@ -1825,9 +1851,8 @@ int game_loop (void) {
if (i == SDL_TRUE) {
bags = 7;
/* TODO: Reproducir el sonido de golpe de yunque */
crash_anim = 0;
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0);
printf ("Penguin Crash by anvil\n");
if (vidas > 0 && try_visible == FALSE) {
try_visible = TRUE;
@ -1860,7 +1885,7 @@ int game_loop (void) {
SDL_FreeSurface (vidas_p);
snprintf (buffer, sizeof (buffer), "%d", vidas);
vidas_p = draw_text_with_shadow (ttf24_klickclack, 2, buffer, blanco, negro);
/* TODO: Reproducir sonido boing */
if (use_sound) Mix_PlayChannel (-1, sounds[SND_BOING], 0);
/* TODO: Mostrar la notificación de 1 vida */
airbone--;
@ -1876,7 +1901,7 @@ int game_loop (void) {
if (i == SDL_TRUE) {
bags = 8;
/* TODO: Reproducir el sonido de golpe de pescado */
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0);
crash_anim = 0;
if (vidas > 0 && try_visible == FALSE) {
try_visible = TRUE;
@ -1903,7 +1928,7 @@ int game_loop (void) {
if (i == SDL_TRUE) {
bags = 9;
/* TODO: Reproducir el sonido de golpe de florero */
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0);
crash_anim = 0;
if (vidas > 0 && try_visible == FALSE) {
@ -1929,16 +1954,20 @@ int game_loop (void) {
if (thisbag->bag <= 3 && j == 0) {
/* Eliminar del airbone */
airbone--;
if (use_sound) Mix_PlayChannel (-1, sounds[SND_SPLOP], 0);
} else if (thisbag->bag == 5 && j == 0) {
/* Eliminar el yunque del airbone */
airbone--;
if (use_sound) Mix_PlayChannel (-1, sounds[SND_ANVIL], 0);
anvil_out = FALSE;
} else if (thisbag->bag == 6 && j == 0) {
/* Eliminar el pescado del airbone */
airbone--;
if (use_sound) Mix_PlayChannel (-1, sounds[SND_FISH], 0);
fish_out = FALSE;
} else if (thisbag->bag == 7 && j == 0) {
airbone--;
if (use_sound) Mix_PlayChannel (-1, sounds[SND_VASE], 0);
flower_out = FALSE;
}
@ -2215,6 +2244,12 @@ int game_loop (void) {
}
if (next_level_visible == NEXT_LEVEL) {
if (animacion == 0) {
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TRUCK], 0);
} else if (animacion == 56) {
if (use_sound) Mix_PlayChannel (-1, sounds[SND_TRUCK_REVERSE], 0);
}
if (animacion < 52) {
/* Presentar el texto del camión descargado */
rect.w = texts[TEXT_UNLOADED]->w;
@ -2425,7 +2460,7 @@ void setup (void) {
colliders_hazard_fish[9] = collider_new_block (11, 18);
if (use_sound) {
/*for (g = 0; g < NUM_SOUNDS; g++) {
for (g = 0; g < NUM_SOUNDS; g++) {
sprintf (buffer_file, "%s%s", systemdata_path, sound_names[g]);
sounds[g] = Mix_LoadWAV (buffer_file);
@ -2439,7 +2474,7 @@ void setup (void) {
exit (1);
}
Mix_VolumeChunk (sounds[g], MIX_MAX_VOLUME / 2);
}*/
}
/* Cargar la música */
//sprintf (buffer_file, "%s%s", systemdata_path, MUS_CARNIE);