' source-8
' Une nouvelle aventure commence... :)
' 2026/05/11
print "CPU vs CPU - développement en cours..."
'show fog #204 to 300
fov 50
?p1 = 0
?p2 = 0
?score_1 = 0
?score_2 = 0
?speed = 0.9
?terrain_horiz = 40
?terrain_vert = 40
?terrain = 40
?axe = 35
?pos = ?terrain_vert * .9
color #246
create sprite 128 as "terrain"
add "terrain" frame 1, 1, 1 to ?terrain_horiz * 2, 40, ?terrain_vert * 2
for 20
?x1 = (random 1 to ?terrain_horiz * 2)
?z1 = (random 1 to ?terrain_vert * 2)
?x2 = (random 1 to ?terrain_horiz * 2)
?z2 = (random 1 to ?terrain_vert * 2)
?y = random 1 to 3
add "terrain" frame ?x1, ?y, ?z1 to ?x2, ?y, ?z2
next
move "terrain" to 0, -5, 0
paint "terrain" to "metal"
zoom y "terrain" to .5
color #0f8
create text "PONG" as "joueur-1"
paint "joueur-1" to "metal"
move "joueur-1" to 0, 0, -?pos
turn y "joueur-1" to 180
color #f40
create text "PONG" as "joueur-2"
move "joueur-2" to 0, 0, ?pos
paint "joueur-2" to "metal"
zoom "joueur-1" to .5
zoom "joueur-2" to .5
create orb as "orb-1"
color "orb-1" to #0f8
glue "orb-1" to "joueur-1"
move z "orb-1" to 5
power "orb-1" to 100
create orb as "orb-2"
color "orb-2" to #f40
glue "orb-2" to "joueur-2"
move z "orb-2" to 5
power "orb-2" to 100
color #0ff
create sprite 3 as "balle"
add "balle" frame 1, 1, 1 to 3, 3, 3
paint "balle" to "neon"
zoom "balle" to 0.5
?horiz = .8
?vertical = .9
create orb
color "orb" to #0ff
glue "orb" to "balle"
power "orb" to 200
move y "orb" to 5
' target "camera" auto "balle"
target "camera" auto 0, -10, 0
'move "camera" to 0, 3, 0
'glue "camera" to "balle"
'target "camera" auto "joueur-2"
do
?rebondi = 0
move x "balle" by ?horiz
move z "balle" by ?vertical
if (abs (move x "balle")) > ?terrain_horiz
negate ?horiz
end
if (abs (move z "balle")) > ?terrain_vert
if ?vertical < 0
goto "score", 1
else
goto "score", 2
end
?rebondi = 1
end
if (hit "balle" to "joueur-1") = 1 and ?vertical < 0
?rebondi = 1
end
if (hit "balle" to "joueur-2") = 1 and ?vertical > 0
?rebondi = 1
end
turn "balle" by 1
?angle + 1
?ray = ?terrain_vert * 2
move "camera" to ?ray * (sin ?angle), 30, ?ray * (cos ?angle)
if ?rebondi = 1
negate ?vertical
?horiz = (sign ?horiz) * (random 0.5 to 1.5)
end
if ?vertical < 0
?dy = (move x "balle") - ?p1
limit ?dy min -?speed max ?speed
?p1 + ?dy
limit ?p1 min -?axe max ?axe
else
?dy = (move x "balle") - ?p2
limit ?dy min -?speed max ?speed
?p2 + ?dy
limit ?p2 min -?axe max ?axe
end
move x "joueur-2" to ?p2
move x "joueur-1" to ?p1
update
loop
label "score"
param ?joueur
if ?joueur = 1
?score_1 + 1
else
?score_2 + 1
end
color 1
create text ?score_1 as "score_1"
paint "score_1" to "ui"
move "score_1" to ?axe, 0, ?terrain
create text ?score_2 as "score_2"
paint "score_2" to "neon"
move "score_2" to ?axe, 0, -?terrain
turn y "score_2" to 180
return