Pong minimaliste
Publié : mer. 15/avr./2026 18:39
Pong pour KCC :
Code : Tout sélectionner
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Pong par SPH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Code : SPH(2026) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;é
InitSprite()
InitMouse()
InitKeyboard()
OpenScreen(1024,768,32,"Pong")
xx=63
yy=47
Dim decors(xx,yy)
For i=0 To xx
decors(i,0)=1
decors(i,yy)=1
Next
ball_x=3
ball_y=3
sens_x=1
sens_y=1
Repeat ; Boucle principale
ClearScreen(0)
ExamineMouse()
ymouse=MouseY()/16
;;;;;;;;;;;
StartDrawing(ScreenOutput())
For u=0 To yy
For i=0 To xx
If decors(i,u)=1
Box(i*16,u*16,16,16,RGB(255,255,255))
EndIf
Next
Next
For u=-2 To 2
Box(xx*16,(u+ymouse)*16,16,16,RGB(255,255,255))
Next
For u=-2 To 2
Box(0,(u+ball_y)*16,16,16,RGB(255,255,255))
Next
Box(ball_x*16,ball_y*16,16,16,RGB(255,255,255))
StopDrawing()
ball_x+sens_x
ball_y+sens_y
If ball_y<1
sens_y*-1
ball_y+sens_y
EndIf
If ball_y>=yy
sens_y*-1
ball_y+sens_y
EndIf
If ball_x<1
sens_x*-1
ball_x+sens_x
EndIf
If ball_x>=xx
If ymouse-2<=ball_y And ymouse+2>=ball_y
sens_x*-1
ball_x+sens_x
Else
End
EndIf
EndIf
FlipBuffers()
Delay(30)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_All)
End