Agrego imagen y animación de crash.

master
Félix Arreola Rodríguez 2019-10-12 13:27:19 -05:00
parent 13fe0e22c0
commit 8aed5a9133
6 changed files with 39 additions and 8 deletions

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -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++;