You are on page 1of 14

#include <allegro.

h>

#define MAXFILA 22
#define MAXCOL 26

/**modific_desde aqui,*/
#define xpant 752
#define ypant 664

#define rojo 0
#define azul 30
#define rosa 60
#define amar 90
#define mora 120
#define sust 150

#define rojo2 150


#define azul2 180
#define rosa2 210
#define amar2 240
#define mora2 270

#define duracion_de_fruta 50
/**midific_asta aqui. */

BITMAP *buffer;
BITMAP *roca;
BITMAP *pacbmp;
BITMAP *pacman;
BITMAP *comida;
BITMAP *muertebmp; /**modific*/
BITMAP *fruta; /**nuevo*/

BITMAP *buffer_bonus_f,*bonus_frut,*line_b,*line_bmp,*lifes;
/**nuevo*/
BITMAP
*buffer_lifes,*punt,*buffer_punt,*crazy,*buffer_crazy,*ini_bmp,*buffer_ini,*buffer_
frut,*frut;/**nuevo*/

SAMPLE *musica1; /**modific*/


SAMPLE *bolita;
SAMPLE *caminando;
SAMPLE *muerte; /**modific*/
SAMPLE *pacma_crazy;/**nuevo*/
SAMPLE *ini; /**nuevo*/
SAMPLE *come_fan; /**nuevo*/
SAMPLE *lifes_up; /**nuevo*/
SAMPLE *aparec_frut;/**nuevo*/
SAMPLE *comi_fruta; /**nuevo*/

int time_fruta =0; /**/


int time_music =0; /**/
int time_music2=0; /**/
int time_musicp=0; /**/
int time_picant=0; /**/
int vidas =3; /**/
int nivel =0; /**nuevo*/
int continua =1; /**/
int xcontador =795; /**/
int ycontador =40; /**/
int puntos =0; /**/
int recor =15000; /**/
int n_d_fresa =0; /**/
int n_d_ceres =0; /**/
int n_d_pinas =0; /**/
int n_d_banan =0; /**/
int ani =0; /**/
int vida_extra =1; /**/
int cont =0; /**/
int posi_ima =0; /**/
int i =0; /**/
int time_frut =0; /**/
int posfx =0; /**/
int posfy =0; /**/
int n_d_f; /**/
int come_fan_color=0; /**/

int dir = 4;
int px;
int py;
int anteriorpx;
int anteriorpy;
int row,col;

bool corre_game=false; /**evita que se muestre el juego si press key=esc durante


la presentacion*/ /**nuevo*/
bool picante =false; /**condicion que inicia las condiciones al comerse un
picante (FRUTAS)*/ /**nuevo*/
bool fruta_bool=false; /**esta variable se hace verdadera durante mientras que
time_frut>=0 para que la fruta aparesca*/ /**nuevo*/
bool come_frut =false; /**si pacman se come la fruta antes d q desaparesca
come_frut=true lo q hace q la fruta se borre en ese momento*/ /**nuevo*/
bool cere,pina,fres,bana;/**estas son para el contador de bonus fruta cada ves que
una de estas se hace true la esa fruta++;*/ /**nuevo*/
bool pac_come_fan=false; /**para solo puedan retornar a su color si se termina el
time_crazy o si pacman se los come*/ /**nuevo*/

void inicia_entorno_grafico(){
allegro_init();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT_WINDOWED ,xpant+164,ypant,0,0);
}

void inicia_sonido(){
if(install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,NULL)!=0){
allegro_message("Error: al iniciar el sonido\n%s\n",allegro_error);
set_volume(100,100);}
}

char mapa_aux[MAXFILA][MAXCOL]={
"XXXXXXXXXXXXXXXXXXXXXXXXX",
"Xuoooo|oooo|X|oooo|oooouX",
"XoXXXXoXXXXoXoXXXXoXXXXoX",
"XoX XoX XoXoX XoX XoX",
"XoXXXXoXXXXoXoXXXXoXXXXoX",
"X|oooo|oooo|o|oooo|oooo|X",
"XoXXXXoXoXXXXXXXoXoXXXXoX",
"X|oooo|Xooo|X|oooX|oooo|X",
"XXXXXXoXXXXoXoXXXXoXXXXXX",
" XoX|ooooooo|XoX ",
"XXXXXXoXoXXiiiXXoXoXXXXXX",
"oooooo|ooXiiiiiXoo|oooooo",
"XXXXXXoXoXXXXXXXoXoXXXXXX",
" XoX|ooooooo|XoX ",
"XXXXXXoXoXXXXXXXoXoXXXXXX",
"X|oooo|oooooXooooo|oooo|X",
"XoXXXXoXXXXoXoXXXXoXXXXoX",
"XoX X|ooooo ooooo|X XoX",
"XoX XoXXXXXXXXXXXoX XoX",
"XoXXXXoXXXXXXXXXXXoXXXXoX",
"Xuoooo|ooooooooooo|oooouX",
"XXXXXXXXXXXXXXXXXXXXXXXXX",
};

char mapa[MAXFILA][MAXCOL];

void copiar_mapa_aux(){
for(row=0; row<MAXFILA ; row++){
for(col=0; col<MAXCOL; col++){
if(mapa_aux[row][col] == 'X'){mapa[row][col]='X';}
if(mapa_aux[row][col] == 'o'){mapa[row][col]='o';}
if(mapa_aux[row][col] == '|'){mapa[row][col]='|';}
if(mapa_aux[row][col] == 'i'){mapa[row][col]='i';}
if(mapa_aux[row][col] == 'u'){mapa[row][col]='u';}
if(mapa_aux[row][col] == ' '){mapa[row][col]=' ';}

}
}
}

void dibujar_mapa(){

for(row=0; row<MAXFILA ; row++){


for(col=0; col<MAXCOL; col++){
if(mapa[row][col] == 'X'){
blit(roca,buffer,32*nivel,0,col*30,row*30,32,32);
}
else if (mapa[row][col] == 'o'||mapa[row][col]=='|'){
draw_sprite(buffer, comida, col*30, row*30);
if(py/30 == row && px/30 == col){
if(time_music2==2)
{play_sample(bolita,100,150,1000,0);time_music2=0;}
if(time_music2<=2){time_music2++;}

/**aqui cuento los punto 10 x pelotita */


if(mapa[row][col] == 'o'||mapa[row][col] =='|'){puntos+=10;}

mapa[row][col] = 'B';
}
}
}
}
}

void pantalla(){
blit(buffer, screen ,0,0,0,0,752+162,664);
}
void dibujar_personaje(){
blit(pacbmp, pacman,dir*33,0,0,0,33,33);
draw_sprite(buffer,pacman,px,py);
}

bool next_level(){
int row,col;
for(row=0; row<MAXFILA ; row++){
for(col=0; col<MAXCOL; col++){
if(mapa[row][col] == 'o'||mapa[row][col] == 'u') return true;}
}return false;
/**mejore esta funcion para que el juego se termine cuando
se coman todas las bolitas='o' y los 4 picantes='u'*/
}

class fantasma{
BITMAP *enemigobmp;
BITMAP *enemigo;
int fdir;
int x;
int y;
int color; /**nuevo*/
int vanderin; /**nuevo*/
int move_img_fan; /**nuevo*/
public:
fantasma(int _x,int _y,int _color);
void dibujar_fantasma();
void mover_fantasma();
void choque_pacman(); /**modific*/
void selec_color_fantasma();/**nuevo*/
void selec_mov_fdir(); /**nuevo*/
};

fantasma::fantasma(int _x, int _y,int _color){


x = _x;
y = _y;
color = _color;
fdir = rand()%4;
move_img_fan=0;
vanderin=0;
enemigo = create_bitmap(30,30);
enemigobmp = load_bitmap("enemigo.bmp",NULL);
}

void fantasma::selec_mov_fdir(){

if(picante==false){
if(fdir==1){/**izquierda*/
if(vanderin<=1){move_img_fan=0;}
if(vanderin==2){move_img_fan=30;vanderin=0;}}
if(fdir==0){/**derecha*/
if(vanderin<=1){move_img_fan=60;}
if(vanderin==2){move_img_fan=90;vanderin=0;}}
if(fdir==4){/**arriba*/
if(vanderin<=1){move_img_fan=120;}
if(vanderin==2){move_img_fan=150;vanderin=0;}}
if(fdir==3){/**abajo*/
if(vanderin<=1){move_img_fan=180;}
if(vanderin==2){move_img_fan=210;vanderin=0;}}
/**el x-si acaso*/
else if(fdir!=1||fdir!=2||fdir!=3||fdir!=0){
if(vanderin<=1){move_img_fan=0;}
if(vanderin==2){move_img_fan=30;vanderin=0;}}
}
if(picante==true){/**esta es para el movimiento de los fantasmas asustados*/
if(vanderin<=1){move_img_fan=0;}
if(vanderin==2){move_img_fan=30;}
if(vanderin==3){move_img_fan=60;}
if(vanderin==4){move_img_fan=90;vanderin=0;}
}
vanderin++;
}

void fantasma::dibujar_fantasma(){

selec_mov_fdir();/**nuevo*/

blit(enemigobmp,enemigo,move_img_fan,color,0,0,xpant,ypant);
masked_blit(enemigo,buffer,0,0,x,y,xpant,ypant);
}

void fantasma::choque_pacman(){

if(py==y&&px==x||y==anteriorpy&&x==anteriorpx){

/**aqui afectael picante*/


if(color==rojo||color==azul||color==amar||color==rosa||color==mora){

play_sample(muerte,100,150,1000,0);
for(int j= 0; j <=10;j++){/**le aumente el numero de iteraciones para
mejorar el efecto de muerte de pacman*/
clear(pacman);
clear(buffer);
dibujar_mapa();

blit(muertebmp,pacman,j*33,0,0,0,33,33);
draw_sprite(buffer,pacman,px,py);

pantalla();
rest(150);
}
vidas--;
px=30*12;
py=30*17;
dir=4;
rest(1000);/**este reste hace que todo el juego se congele un segundos
mientras pacman muere*/
}}
if(py==y&&px==x||y==anteriorpy&&x==anteriorpx){

/**aqui afectael picante*/


if(color==rojo2||color==azul2||color==amar2||color==rosa2||color==mora2){

play_sample(come_fan,100,150,1000,0);
for(int j= 0; j <=9;j++){/**le aumente el numero de iteraciones para
mejorar el efecto de muerte de pacman*/
clear(enemigo);
clear(buffer);
dibujar_mapa();

blit(enemigobmp,enemigo,j*30,150,0,0,30,30);
draw_sprite(buffer,enemigo,px,py);

pantalla();
rest(150);
}
x=30*11;
y=30*11;
puntos+=200;
if(color==rojo2){come_fan_color=1;}
if(color==azul2){come_fan_color=2;}
if(color==rosa2){come_fan_color=3;}
if(color==amar2){come_fan_color=4;}
if(color==mora2){come_fan_color=5;}
rest(1000);/**este reste hace que todo el juego se congele un segundos
mientras pacman muere*/
}
}
}

void fantasma::mover_fantasma(){
dibujar_fantasma();
choque_pacman();
selec_color_fantasma();

if(mapa[y/30][x/30] == '|'||mapa[y/30][x/30]=='i' ){
fdir = rand()%4;

}
if(fdir == 0){
if(mapa[y/30][(x-30)/30] != 'X')x -=30;
else fdir = rand()%4;
}
if(fdir == 1){
if(mapa[y/30][(x+30)/30] != 'X')x +=30;
else fdir = rand()%4;
}
if(fdir == 2){
if(mapa[(y-30)/30][x/30] != 'X')y -=30;
else fdir = rand()%4;
}
if(fdir == 3){
if(mapa[(y+30)/30][x/30] != 'X')y +=30;
else fdir = rand()%4;
}
if(x <= -30) x = 720;
else if (x >= 750) x=-30;
}

void fantasma::selec_color_fantasma(){

if(picante==true){
if(color==rojo&&come_fan_color==0){color=rojo2;}
if(color==azul&&come_fan_color==0){color=azul2;}
if(color==rosa&&come_fan_color==0){color=rosa2;}
if(color==amar&&come_fan_color==0){color=amar2;}
if(color==mora&&come_fan_color==0){color=mora2;}
}
if(color==rojo2&&come_fan_color==1||color==rojo2&&picante==false)
{color=rojo;}
if(color==azul2&&come_fan_color==2||color==azul2&&picante==false)
{color=azul;}
if(color==rosa2&&come_fan_color==3||color==rosa2&&picante==false)
{color=rosa;}
if(color==amar2&&come_fan_color==4||color==amar2&&picante==false)
{color=amar;}
if(color==mora2&&come_fan_color==5||color==mora2&&picante==false)
{color=mora;}
}

void move_pacman(){

if(dir != 4)
anteriorpx = px;
anteriorpy = py;

if(key[KEY_RIGHT]) dir = 1;
else if(key[KEY_LEFT]) dir = 0;
else if(key[KEY_UP]) dir = 2;
else if(key[KEY_DOWN]) dir = 3;

if(dir == 0){
if(mapa[py/30][(px-30)/30] != 'X')
px -= 30;
else dir = 4;
}
if(dir == 1){
if(mapa[py/30][(px+30)/30] != 'X')
px += 30;
else dir = 4;

}
if(dir == 2){
if(mapa[(py-30)/30][px/30] != 'X'&&mapa[(py-30)/30][(px)/30]!
='i')/**para que pacman no entre a la jaula de los fantasmas*/
py -= 30;
else dir = 4;

}
if(dir == 3){
if(mapa[(py+30)/30][px/30] != 'X'&&mapa[(py+30)/30][(px)/30]!
='i')/**para que pacman no entre a la jaula de los fantasmas*/
py += 30;
else dir = 4;
}

if(px <= -30) px = 720;


else if (px >= 750) px=-30;

void activo_picant(){
picante=true;
/**tiempo de duracion de pacman crazy(come fantasma y music)*/
if(picante==true){
if(time_picant>=0){

if(time_musicp==2||picante==true){time_musicp=0;
play_sample(pacma_crazy,100,150,1000,0);}
if(time_musicp<=2){time_musicp--;}

if(picante==true&&time_picant==0){time_picant+=50;}
}time_picant--;
if(time_picant==0){picante=false;come_fan_color=0;}
}
}

void dibujar_comida(){
int row,col;

for(row=0; row<MAXFILA ; row++){


for(col=0; col<MAXCOL; col++){
if(mapa[row][col] == 'u'){
draw_sprite(buffer, fruta, col*30, row*30);
}
if(py/30 == row && px/30 == col){

if(mapa[row][col] == 'u'){mapa[row][col]=' ';


if(picante==true){time_picant+=50;come_fan_color=0;}/**si
pacman esta crazy y pasa por un picante el time picante sube+40*/
activo_picant();}

}
}
}
}

void frutas(){
/**fresa */
blit(bonus_frut,buffer_bonus_f,89,0,0,0,30,30);
masked_blit(buffer_bonus_f,buffer,0,0,787+10,310,30,30);
/**cereza*/
blit(bonus_frut,buffer_bonus_f,0,0,0,0,30,30);
masked_blit(buffer_bonus_f,buffer,0,0,792+10,345,30,30);
/**pi�a */
blit(bonus_frut,buffer_bonus_f,60,0,0,0,30,30);
masked_blit(buffer_bonus_f,buffer,0,0,787+10,395,30,30);
/**banana*/
blit(bonus_frut,buffer_bonus_f,30,0,0,0,30,30);
masked_blit(buffer_bonus_f,buffer,0,0,792+10,435,30,30);

blit(line_bmp,line_b,0,0,0,0,170,662);
masked_blit(line_b,buffer,0,0,753,0,210,662);

blit(lifes,buffer_lifes,0,0,0,0,30,30);
masked_blit(buffer_lifes,buffer,0,0,792,100,30,30);

blit(punt,buffer_punt,0,0,0,0,30,30);
masked_blit(buffer_punt,buffer,0,0,792,160,30,30);

blit(crazy,buffer_crazy,0,0,0,0,30,30);
masked_blit(buffer_crazy,buffer,0,0,792,220,30,30);
}

void ani_ini(){
textprintf_ex(buffer,font,410,200,makecol(255,255,0),-1,"RECORD ACTUAL");
if(recor>puntos){textprintf_ex(buffer,font,430,210,makecol(255,255,0),-
1,"\"%d\"",recor);}
else textprintf_ex(buffer,font,430,210,makecol(255,255,0),-
1,"\"%d\"",puntos);

blit(ini_bmp,buffer_ini,posi_ima,0,0,0,396,228);
masked_blit(buffer_ini,buffer,0,0,260,250,396,228);

if(posi_ima==0){posi_ima=397;}
else posi_ima=0;
rest(200);

void menu_inicio(){

int repit=0;

while(!key[KEY_ENTER]&&!key[KEY_ESC]){

pantalla();clear(buffer_ini),clear(buffer);
ani_ini();

if(repit==0){play_sample(ini,150,100,1000,0);}
if(repit==25){play_sample(ini,150,100,1000,0);repit=1;}
if(repit<=25){repit++;}

}
}

void THE_END_GAME(){
BITMAP *gm,*gmb;
SAMPLE *gms;
gmb=create_bitmap(348,270);
gms=load_sample("gms.wav");
gm=load_bitmap("gm.bmp",NULL);
play_sample(gms,100,150,1000,0);
blit(gm,gmb,0,0,0,0,348,270);
masked_blit(gmb,screen,0,0,270,180,382,270);
rest(4000);
}

void fin(){
BITMAP *f,*fb;
clear(screen);
fb=create_bitmap(348,270);
f=load_bitmap("f.bmp",NULL);
blit(f,fb,0,0,0,0,348,270);
masked_blit(fb,screen,0,0,270,180,382,270);
rest(4000);
}

void contador(){
textprintf_ex(buffer,font,xcontador+15,ycontador,makecol(255,255,0),-
1,"RECORD");

if(recor>puntos)
{textprintf_ex(buffer,font,xcontador+10,ycontador+10,makecol(255,255,0),-
1,"\"%d\"",recor);}
else
textprintf_ex(buffer,font,xcontador+10,ycontador+10,makecol(255,255,0),-
1,"\"%d\"",puntos);

textprintf_ex(buffer,font,xcontador+5,ycontador+30, makecol (255,255,0),-1,


"Nivel : %d",nivel+1);

textprintf_ex(buffer,font,xcontador,ycontador+50,makecol(255,255,0),-1,"
Vidas");
textprintf_ex(buffer,font,xcontador,ycontador+70,makecol(255,255,0),-1," X
%d",vidas);

textprintf_ex(buffer,font,xcontador,ycontador+110,makecol(255,255,0),-
1,"Puntuacion");
textprintf_ex(buffer,font,xcontador,ycontador+130,makecol(255,255,0),-1," :
%d",puntos);

textprintf_ex(buffer,font,xcontador,ycontador+170,makecol(255,255,0),-1,"
Crazy");
textprintf_ex(buffer,font,xcontador,ycontador+190,makecol(255,255,0),-1," :
%d",time_picant);

textprintf_ex(buffer,font,xcontador-9,ycontador+240,makecol(255,255,0),-
1,"FRUTAS BONUS");

textprintf_ex(buffer,font,xcontador,ycontador+280,makecol(255,255,0),-1," X
%d",n_d_fresa);
textprintf_ex(buffer,font,xcontador,ycontador+325,makecol(255,255,0),-1," X
%d",n_d_ceres);
textprintf_ex(buffer,font,xcontador,ycontador+365,makecol(255,255,0),-1," X
%d",n_d_pinas);
textprintf_ex(buffer,font,xcontador,ycontador+405,makecol(255,255,0),-1," X
%d",n_d_banan);

textprintf_ex(buffer,font,xcontador+25,ycontador+500,makecol(255,255,0),-
1,"PARA");
textprintf_ex(buffer,font,xcontador+17,ycontador+510,makecol(255,255,0),-
1,"PAUSAR");
textprintf_ex(buffer,font,xcontador+10,ycontador+520,makecol(255,255,0),-
1,"PRESIONE");
textprintf_ex(buffer,font,xcontador+16,ycontador+530,makecol(255,255,0),-
1,"<ENTER>");

void cargando_datos(){

buffer_frut = create_bitmap(30,30);
buffer_bonus_f = create_bitmap(30,30);
buffer_lifes = create_bitmap(30,30);
buffer_punt = create_bitmap(30,30);
buffer_crazy = create_bitmap(30,30);
pacman = create_bitmap(33,33);
buffer = create_bitmap(916,664);
line_b = create_bitmap(170,662);
buffer_ini = create_bitmap(396,228);

ini_bmp = load_bitmap("ini.bmp",NULL);
line_bmp = load_bitmap("line.bmp",NULL);
lifes = load_bitmap("life.bmp",NULL);
roca = load_bitmap("roca.bmp",NULL);
crazy = load_bitmap("crazy.bmp",NULL);
punt = load_bitmap("punto.bmp",NULL);
fruta = load_bitmap("fruta.bmp",NULL);
pacbmp = load_bitmap("pacman.bmp",NULL);
comida = load_bitmap("Comida.bmp",NULL);
muertebmp = load_bitmap("muerte.bmp",NULL);
frut = load_bitmap("frutas_bonus.bmp",NULL);
bonus_frut = load_bitmap("frutas_bonus.bmp",NULL);

pacma_crazy= load_wav("pc.wav");
lifes_up = load_wav("life_up.wav");
come_fan = load_wav("come_fan.wav");
comi_fruta = load_wav("comi_fruta.wav");
aparec_frut= load_wav("aparec_frut.wav");
muerte = load_wav("pacman muerte.wav");
bolita = load_wav("pacman-comiendo.wav");
musica1 = load_wav("pacman-sonido fundo.wav");
caminando = load_wav("pacman-sonido fondo.wav");
ini = load_wav("pacman sonido intro.wav");
}

void funcion_grupo1(){
clear(buffer);
frutas();
contador();
dibujar_mapa();
dibujar_personaje();
dibujar_comida();
pantalla();
}

void funcion_grupo2(){
rest(2000);
play_sample(musica1,100,150,1000,0);
}

void sonidos_del_juego(){

corre_game=true;
if(time_music==4){play_sample(caminando,100,150,1000,0);time_music=0; }
if(time_music<=4){time_music++;}
if(picante==true){activo_picant();}

void limp_rastros(){
clear(pacman);
blit(pacbmp, pacman,4*33,0,0,0,33,33);
draw_sprite(buffer,pacman,px,py);
pantalla();
rest(90);
}
void pause(){
clear(buffer);
while(!key[KEY_P]){
textprintf_ex(buffer,font,xcontador-350,ycontador+300,makecol(255,255,0),-1,"
PAUSA");
textprintf_ex(buffer,font,xcontador-350,ycontador+320,makecol(255,255,0),-
1,"PRESIONE");
textprintf_ex(buffer,font,xcontador-350,ycontador+330,makecol(255,255,0),-1,"
<P> ");
textprintf_ex(buffer,font,xcontador-350,ycontador+350,makecol(255,255,0),-1,"
PARA ");
textprintf_ex(buffer,font,xcontador-350,ycontador+360,makecol(255,255,0),-
1,"CONTINUAR");
pantalla();
}
}

void life_up(){
if(puntos>=5000*vida_extra){
play_sample(lifes_up,100,150,1000,0);
vidas++;
vida_extra++;}
}

void pac_come_frut(){
if(py == posfy && px == posfx){
play_sample(comi_fruta,100,150,1000,0);
come_frut=true;
puntos+=250;
if(cere==true){n_d_ceres++;}
if(bana==true){n_d_banan++;}
if(pina==true){n_d_pinas++;}
if(fres==true){n_d_fresa++;}
}
}

void fruta_aleatoria(){
cont++;
pac_come_frut();
if(cont==150){fruta_bool=true;cont=0;i=0;n_d_f=rand()%4;}

if(fruta_bool==true&&time_frut<=duracion_de_fruta&&come_frut==false){
posfx=30*12,posfy=30*13;
time_frut++;
if(time_frut==1){play_sample(aparec_frut,100,150,1000,0);}
if(n_d_f==0)
{cere=true;blit(frut,buffer_frut,i,0,0,0,30,30);masked_blit(buffer_frut,buffer,0,0,
posfx,posfy,30,30);}
if(n_d_f==1)
{bana=true;blit(frut,buffer_frut,i+30,0,0,0,30,30);masked_blit(buffer_frut,buffer,0
,0,posfx,posfy,30,30);}
if(n_d_f==2)
{pina=true;blit(frut,buffer_frut,i+60,0,0,0,30,30);masked_blit(buffer_frut,buffer,0
,0,posfx,posfy,30,30);}
if(n_d_f==3)
{fres=true;blit(frut,buffer_frut,i+89,0,0,0,30,30);masked_blit(buffer_frut,buffer,0
,0,posfx,posfy,30,30);}
}
if(time_frut==50&&fruta_bool==true||come_frut==true&&fruta_bool==true){
fruta_bool=false;
come_frut=false;
time_frut=0;
posfx=0;posfy=0;
i=0;
cere=false;
bana=false;
pina=false;
fres=false;
}
}

void felicidades(){
while(!key[KEY_ENTER]){
pantalla();clear(buffer_ini),clear(buffer);

blit(ini_bmp,buffer_ini,posi_ima,229,0,0,396,228);
masked_blit(buffer_ini,buffer,0,0,260,250,396,228);

if(posi_ima==0){posi_ima=397;}
else posi_ima=0;
rest(200);
}
}

int main() {

inicia_entorno_grafico();
inicia_sonido();
install_keyboard();

cargando_datos();
menu_inicio();

while(!key[KEY_ESC]&&vidas>=1){
px=30*12,py=30*17;
copiar_mapa_aux();

fantasma A(30*10,30*11,rojo);
fantasma B(30*11,30*11,azul);
fantasma C(30*12,30*11,amar);
fantasma D(30*13,30*11,rosa);
fantasma E(30*14,30*11,mora);

funcion_grupo1();
funcion_grupo2();

while(!key[KEY_ESC] && next_level()&&vidas>=1){


if(key[KEY_ENTER]){pause();}
life_up();/**je je je si logras llegar a (5000*vida_extra)puntos, te regalo otra
vida^^,*/
sonidos_del_juego();
move_pacman();
funcion_grupo1();
fruta_aleatoria();

A.mover_fantasma();
B.mover_fantasma();
C.mover_fantasma();
D.mover_fantasma();
E.mover_fantasma();

pantalla();
rest(58);

limp_rastros();

} if(vidas>=1&&!key[KEY_ESC]){THE_END_GAME();} nivel++;
if(vidas==0){fin();}
} if(nivel==12){felicidades();} return 1;

} END_OF_MAIN();

You might also like