Agrego activador de las bolsas.

master
Félix Arreola Rodríguez 2018-06-03 17:37:35 -05:00
parent e0ab125eda
commit 9a932762e9
2 changed files with 39 additions and 7 deletions

View File

@ -5,7 +5,8 @@ gamedatadir = $(pkgdatadir)/data
bin_PROGRAMS = bean-counters-classic
bean_counters_classic_SOURCES = beans.c \
gfx_blit_func.c gfx_blit_func.h \
path.c path.h
path.c path.h \
gettext.h
if MACOSX
bean_counters_classic_SOURCES += SDLMain.m SDLMain.h

View File

@ -28,6 +28,9 @@
#include <SDL_mixer.h>
#include <SDL_ttf.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -42,6 +45,7 @@
#define FPS (1000/24)
#define RANDOM(x) ((int) (x ## .0 * rand () / (RAND_MAX + 1.0)))
#define RANDOM_VAR(x) ((int) (((float) x) * rand () / (RAND_MAX + 1.0)))
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
#define RMASK 0xff000000
@ -533,6 +537,10 @@ int game_loop (void) {
int penguin_frame = 0;
int i, j;
int level, activator;
int bag_activity = 15;
int airbone, max_airbone = 1;
/* Predibujar todo */
/*SDL_FillRect (screen, NULL, 0);
SDL_Flip (screen);*/
@ -587,6 +595,7 @@ int game_loop (void) {
}
}
if (bags < 6) {
SDL_GetMouseState (&handposx, NULL);
penguinx = handposx;
@ -595,6 +604,20 @@ int game_loop (void) {
} else if (penguinx > 555) {
penguinx = 555;
}
}
activator = RANDOM_VAR (bag_activity);
if (activator <= 2 && bags < 6 /* AND Game Over not visible */) {
if (airbone < max_airbone) {
i = RANDOM (8);
if (i <= 3) {
add_bag (i);
airbone++;
}
}
}
/* Procesar las bolsas */
thisbag = first_bag;
@ -604,6 +627,14 @@ int game_loop (void) {
thisbag->frame++;
j = thisbag->frame - thisbag->throw_length;
/* Calcular aquí la colisión contra el pingüino */
if (j == 0) {
/* Eliminar del airbone */
airbone--;
}
if (j >= 35) {
/* Eliminar esta bolsa */
delete_bag (thisbag);