(https://www.comunidadgm.org/images/pl_gen.png) ... | (https://www.comunidadgm.org/images/pl_ver.png) All GM |
{
if(score<2)
{
juegoEstado="portada";
juegoEstadoCreate=1;
score=2;
celdas=17;
//#Bloquear="
roomwidth=room_width;
roomheight=room_height;
//"
celdaW_asd=roomwidth/celdas;
celdaH_asd=roomheight/celdas;
ballW_asd=1*celdaW_asd-2;
ballH_asd=1*celdaH_asd-2;
ballx_asd=8*celdaW_asd;
bally_asd=8*celdaH_asd;
balldx_asd=1-2*floor(random(2));
balldy_asd=1-2*floor(random(2));
ballxstar_asd=ballx_asd;
ballystar_asd=bally_asd;
ballVelocidadInicial=4;
ballVelocidad=ballVelocidadInicial;
ballVelocidadMaxima=10;
ballEstado="stop";
ballEstadoCreate=1;
ballTiempo=0;
ballTiempo2=0;
ballAceleracion=0.5;
tabla1H_asd=5*celdaH_asd-2;
tabla1W_asd=1*celdaW_asd-2;
tabla1ypos_asd=7*celdaH_asd;
tabla1x1_asd=1*celdaW_asd;
tabla1y1_asd=tabla1ypos_asd;
tabla1Velocidad=12;
tabla2H_asd=5*celdaH_asd-2;
tabla2W_asd=1*celdaW_asd-2;
tabla2ypos_asd=7*celdaH_asd;
tabla2x1_asd=15*celdaW_asd;
tabla2y1_asd=tabla2ypos_asd;
tabla2VelocidadInicial=12;
tabla2Velocidad=tabla2VelocidadInicial;
tabla2posicion=0;
tabla2posicionx=tabla2x1_asd+tabla2W_asd/2;
tabla2posiciony=0;
mb=0;
puntoP2=0;
puntoP1=0;
}
//botones a usar
//#bloquear="
if(keyboard_check(113)){game_restart()}
//mbp=(mb=0)*(mouse_button=1);
mousebutton=mouse_button;
//"
mb=(mousebutton=1);
if(juegoEstado="portada")
{
if(juegoEstadoCreate)
{
tiempo=0;
juegoEstadoCreate=0;
}
x1=8*celdaW_asd;
y1=5*celdaH_asd;
txt="Pong";
draw_text(x1,y1,txt);
tiempo+=1;
if(mb and tiempo>30){juegoEstado="juego";juegoEstadoCreate=1}
}
if(juegoEstado="final")
{
if(juegoEstadoCreate)
{
juegoEstadoCreate=0;
tiempo=0;
x1=7*celdaW_asd;
y1=5*celdaH_asd;
}
tiempo+=1;
x1=7*celdaW_asd;
y1=5*celdaH_asd;
txt="Gana el humano";
if(puntoP2>puntoP1){txt="Gana la PC"}
draw_text(x1,y1,txt);
if(mb and (tiempo>20)){score=0}
}
if(juegoEstado="juego")
{
if(juegoEstadoCreate)
{
juegoEstadoCreate=0
}
tabla1ypos_asd+=tabla1Velocidad-2*mb*tabla1Velocidad;
if(balldx_asd)
{
if((tabla2posiciony-ballH_asd)>(tabla2ypos_asd+(tabla2H_asd/4))){tabla2ypos_asd+=tabla2Velocidad}
if(tabla2posiciony<(tabla2ypos_asd+(tabla2H_asd/4))){tabla2ypos_asd-=tabla2Velocidad}
}
if((balldx_asd=-1) || (ballEstado="stop"))
{
if(tabla2ypos_asd>celdaH_asd*6){tabla2ypos_asd-=tabla2Velocidad}
if(tabla2ypos_asd<celdaH_asd*6){tabla2ypos_asd+=tabla2Velocidad}
}
if(ballEstado="play")
{
if(ballEstadoCreate)
{
ballEstadoCreate=0;
ballVelocidad=ballVelocidadInicial;
ballTiempo=0;
ballTiempo2=0;
ballx_asd=ballxstar_asd;
bally_asd=ballystar_asd;
balldx_asd=1-2*floor(random(2));
balldy_asd=1-2*floor(random(2));
tabla2Velocidad=tabla2VelocidadInicial;
}
ballTiempo+=ballVelocidad;
if(ballTiempo>=30)
{
ballTiempo=0;
ballx_asd+=balldx_asd*celdaW_asd;
bally_asd+=balldy_asd*celdaH_asd;
}
ballTiempo2+=1;
if(ballTiempo2>=30)
{
ballTiempo2=0;
ballVelocidad+=ballAceleracion;
if(ballVelocidad>ballVelocidadMaxima){ballVelocidad=ballVelocidadMaxima}
}
if(ballx_asd>(roomwidth-celdaW_asd)){ballx_asd=(roomwidth-celdaW_asd);ballEstado="stop";puntoP1+=1;ballEstadoCreate=1}
if(ballx_asd<0){ballx_asd=0;ballEstado="stop";puntoP2+=1;ballEstadoCreate=1}
c1=(puntoP1=3);
c2=(puntoP2=3);
if(c1 || c2){juegoEstado="final";juegoEstadoCreate=1}
}
else
{
if(ballEstadoCreate)
{
ballEstadoCreate=0;
ballTiempo=0;
}
ballTiempo+=1;
if((ballTiempo>30) and mb){ballEstado="play";ballEstadoCreate=1}
ballVelocidad=0;
}
}//fin if(juegoEstado="juego")
c1=(ballx_asd>tabla1x1_asd);
c2=(ballx_asd<tabla1x1_asd+tabla1W_asd+celdaW_asd);
c3=((bally_asd+1*ballH_asd)>tabla1y1_asd);
c4=(bally_asd<tabla1y1_asd+tabla1H_asd);
if(c1 and c2 and c3 and c4){balldx_asd=1}
c1=((ballx_asd+ballW_asd)<(tabla2x1_asd+tabla2W_asd));
c2=((ballx_asd+ballW_asd)>(tabla2x1_asd-celdaW_asd));
c3=((bally_asd+1*ballH_asd)>tabla2y1_asd);
c4=(bally_asd<tabla2y1_asd+tabla2H_asd);
c5=(balldx_asd=1);
if(c1 and c2 and c3 and c4 and c5){balldx_asd=-1;tabla2Velocidad-=1;if(tabla2Velocidad<0.5){tabla2Velocidad=0.5}}
if(bally_asd>(roomheight-1*celdaH_asd)){bally_asd=(roomheight-1*celdaH_asd);balldy_asd=-1}
if(bally_asd<0){bally_asd=0;balldy_asd=1}
x1=1+ballx_asd;
y1=1+bally_asd;
draw_line(x1,y1,x1+ballW_asd,y1);
draw_line(x1+ballW_asd,y1,x1+ballW_asd,y1+ballH_asd);
draw_line(x1+ballW_asd,y1+ballH_asd,x1,y1+ballH_asd);
draw_line(x1,y1+ballH_asd,x1,y1);
if(balldx_asd and balldy_asd){balldirection=-45}
if(balldx_asd and !balldy_asd){balldirection=45}
if(!balldx_asd and !balldy_asd){balldirection=135}
if(!balldx_asd and balldy_asd){balldirection=225}
pdx_asd=balldx_asd;
pdy_asd=balldy_asd;
pdirection=balldirection;
if(pdx_asd and pdy_asd){pdirection=-45}
if(pdx_asd and !pdy_asd){pdirection=45}
if(!pdx_asd and !pdy_asd){pdirection=135}
if(!pdx_asd and pdy_asd){pdirection=225}
x1=ballx_asd;
y1=bally_asd;
x2=x1;
y2=y1;
tabla2posicion=0;
i=0;
repeat(16)
{
i+=1;
x2=x1+i*celdaW_asd*cos(pdirection*pi/180);
y2=y1-i*celdaH_asd*sin(pdirection*pi/180);
if(y2>roomheight){y2=roomheight;pdy_asd=-1;x1=x2;y1=y2;i=0}
if(y2<0){y2=0;pdy_asd=1;x1=x2;y1=y2;i=0}
if(x2>roomwidth){x2=roomwidth;pdx_asd=-1;x1=x2;y1=y2;i=0}
if(x2<0){x2=0;pdx_asd=1;x1=x2;y1=y2;i=0}
c1=(y2>tabla1ypos_asd);
c2=(y2<(tabla1ypos_asd+tabla1H_asd));
c3=(x2>tabla1x1_asd);
c4=(x2<(tabla1x1_asd+tabla1W_asd));
if(c1 and c2 and c3 and c4){x2=(tabla1x1_asd+tabla1W_asd);pdx_asd=1;x1=x2;y1=y2;i=0}
if(pdx_asd and pdy_asd){pdirection=-45}
if(pdx_asd and !pdy_asd){pdirection=45}
if(!pdx_asd and !pdy_asd){pdirection=135}
if(!pdx_asd and pdy_asd){pdirection=225}
if(tabla2posicion=0)
{
c1=(x2>=(tabla2x1_asd-celdaW_asd));
if(c1){tabla2posicion=1;tabla2posicionx=x2;tabla2posiciony=y2}
}
//draw_pixel(x2,y2);
}
//draw_circle(tabla2posicionx,tabla2posiciony,5);
if(tabla1ypos_asd>(roomheight-tabla1H_asd)){tabla1ypos_asd=(roomheight-tabla1H_asd)}
if(tabla1ypos_asd<0){tabla1ypos_asd=0}
tabla1y1_asd=floor(tabla1ypos_asd/celdaH_asd)*celdaH_asd;
x1=1+tabla1x1_asd;
y1=1+tabla1y1_asd;
draw_line(x1,y1,x1+tabla1W_asd,y1);
draw_line(x1+tabla1W_asd,y1,x1+tabla1W_asd,y1+tabla1H_asd);
draw_line(x1+tabla1W_asd,y1+tabla1H_asd,x1,y1+tabla1H_asd);
draw_line(x1,y1+tabla1H_asd,x1,y1);
if(tabla2ypos_asd>(roomheight-tabla2H_asd)){tabla2ypos_asd=(roomheight-tabla2H_asd)}
if(tabla2ypos_asd<0){tabla2ypos_asd=0}
tabla2y1_asd=floor(tabla2ypos_asd/celdaH_asd)*celdaH_asd;
x1=1+tabla2x1_asd;
y1=1+tabla2y1_asd;
draw_line(x1,y1,x1+tabla2W_asd,y1);
draw_line(x1+tabla2W_asd,y1,x1+tabla2W_asd,y1+tabla2H_asd);
draw_line(x1+tabla2W_asd,y1+tabla2H_asd,x1,y1+tabla2H_asd);
draw_line(x1,y1+tabla2H_asd,x1,y1);
x1=8*celdaW_asd;
y1=1*celdaH_asd;
txt=string(puntoP1)+"/"+string(puntoP2);
draw_text(x1,y1,txt);
}
Compatibilidad comprobada: ⭐ (http://imgfz.com/i/mRKT0Mi.png) Funciona en todos los Game makers desde el antiguo Game Maker 1.4 (june 1, 2000) hasta GameMaker studio 2. No ha sido verificado si el juego funciona en los game makers para mac pero la teoria dice que sí. |