|
|
|
Graphics 800,600
'---PALO IZQUIERDO------
'POSICION
Global palx% = 10
Global paly% = 275
'TAMAu00d1O
Global tamy% = 50
'VELOCIDAD
Global velpa% = 3
'---PALO DERECHO------
'POSICION
Global palx1% = 780
Global paly1% = 275
'TAMAu00d1O
Global tamy1% = 50
'VELOCIDAD
Global velpa1% = 30
'---BOLA------
'POSICION
Global bolx% = 390
Global boly% = 290
'TAMAu00d1O
Global tambolx% = 20
Global tamboly% = 20
'VELOCIDAD
Global velbolx% = -1
Global velboly% = 1
'---MARCADOR------
Global pl1% = 0
Global pl2% = 0
While Not KeyDown (KEY_ESCAPE)
DrawText "JPSWEBER",380,20
Dibujar()
Control()
Colision()
Bola()
Puntos()
Flip
Cls
Wend
Function Dibujar()
DrawRect palx,paly,10,tamy
DrawRect palx1,paly1,10,tamy1
DrawRect bolx,boly,tambolx,tamboly
DrawText pl1,200,20
DrawText pl2,600,20
EndFunction
Function Control()
If KeyDown(KEY_UP) Then paly1:-velpa1
If KeyDown(KEY_DOWN) Then paly1:+velpa1
If KeyDown(KEY_W) Then paly:-velpa
If KeyDown(KEY_S) Then paly:+velpa
EndFunction
Function Colision()
If paly > 550 Then paly = 550
If paly1 > 550 Then paly = 550
If paly < 0 Then paly = 0
If paly1 < 0 Then paly1 = 0
If boly < 0 Then boly = 0; velboly:*-1
If boly > 580 Then boly = 580; velboly:*-1
If boly +20 > paly And boly < paly + 50 And bolx < palx+10 And bolx > palx-1 Then velbolx:*-1
If boly +20 > paly1 And boly < paly1 + 50 And bolx+20 > palx1 And bolx < palx1+1 Then velbolx:*-1
EndFunction
Function Bola()
bolx:-velbolx
boly:-velboly
EndFunction
Function Puntos()
If bolx +20 < 0 Then pl2:+1; bolx = 390; boly = 290
If bolx > 800 Then pl1:+1; bolx = 390; boly = 290
EndFunction |
|
|
|
|
|
|