diff --git a/data/Makefile.am b/data/Makefile.am index cc7fd79..e24d33b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -130,7 +130,11 @@ nobase_dist_gamedata_DATA = images/background.png \ images/fish.png \ images/fish_dropped.png \ images/flower.png \ - images/flower_dropped.png + images/flower_dropped.png \ + images/crash_1.png \ + images/crash_2.png \ + images/crash_3.png \ + images/crash_4.png # Instalar los archivos .desktop e iconos applicationsdir = $(datadir)/applications diff --git a/data/images/crash_1.png b/data/images/crash_1.png new file mode 100644 index 0000000..9f3caf0 Binary files /dev/null and b/data/images/crash_1.png differ diff --git a/data/images/crash_2.png b/data/images/crash_2.png new file mode 100644 index 0000000..a1f29a2 Binary files /dev/null and b/data/images/crash_2.png differ diff --git a/data/images/crash_3.png b/data/images/crash_3.png new file mode 100644 index 0000000..bed4501 Binary files /dev/null and b/data/images/crash_3.png differ diff --git a/data/images/crash_4.png b/data/images/crash_4.png new file mode 100644 index 0000000..edd9f1d Binary files /dev/null and b/data/images/crash_4.png differ diff --git a/src/beans.c b/src/beans.c index 3d2fe17..16f0294 100644 --- a/src/beans.c +++ b/src/beans.c @@ -199,6 +199,11 @@ enum { IMG_FLOWER, IMG_FLOWER_DROPPED, + IMG_CRASH_1, + IMG_CRASH_2, + IMG_CRASH_3, + IMG_CRASH_4, + NUM_IMAGES }; @@ -306,7 +311,12 @@ const char *images_names[NUM_IMAGES] = { "images/fish_dropped.png", "images/flower.png", - "images/flower_dropped.png" + "images/flower_dropped.png", + + "images/crash_1.png", + "images/crash_2.png", + "images/crash_3.png", + "images/crash_4.png" }; enum { @@ -1026,13 +1036,10 @@ int game_loop (void) { int oneup_toggle = TRUE; int fish_max = 4; int fish_counter = 0; + int crash_anim = -1; int bag_stack = 0; - /* Predibujar todo */ - /*SDL_FillRect (screen, NULL, 0); - SDL_Flip (screen);*/ - SDL_EventState (SDL_MOUSEMOTION, SDL_IGNORE); do { @@ -1213,6 +1220,7 @@ int game_loop (void) { /* TODO: Reproducir el sonido de golpe de yunque */ /* TODO: Acomodar la animación de "Crash" */ + crash_anim = 0; printf ("Penguin Crash by anvil\n"); if (vidas > 0) { @@ -1255,7 +1263,8 @@ int game_loop (void) { bags = 8; /* TODO: Reproducir el sonido de golpe de pescado */ - /* Acomodar la animación de crash */ + crash_anim = 0; + if (vidas > 0) { try_visible = TRUE; animacion = 0; @@ -1279,7 +1288,7 @@ int game_loop (void) { bags = 9; /* TODO: Reproducir el sonido de golpe de florero */ - /* TODO: Acomodar la animación de "Crash" */ + crash_anim = 0; if (vidas > 0) { try_visible = TRUE; @@ -1483,6 +1492,24 @@ int game_loop (void) { thisbag = thisbag->next; } + if (crash_anim >= 0) { + if (crash_anim == 4) { + i = IMG_CRASH_4; + } else { + i = IMG_CRASH_1 + crash_anim; + } + rect.x = penguinx - 90; + rect.y = 282; + rect.w = images[i]->w; + rect.h = images[i]->h; + + SDL_BlitSurface (images[i], NULL, screen, &rect); + + crash_anim++; + + if (crash_anim == 5) crash_anim = -1; + } + if (try_visible == TRUE) { animacion++;