J'ai ce scritp (merci à Strofe et aurel2108) :
► Afficher le textevoir le script
Code : Tout sélectionner
HotKeySet("{ESC}", "Terminate")
Func Terminate()
Exit 0
EndFunc
#include <StaticConstants.au3>
#include <GUIConstants.au3>
$gui=guicreate("Snake", 900,600)
guisetstate(@sw_show)
global $direction = 1, $bx = 400, $by = 595, $moves = 1, $ai, $up, $down, $left, $right
dim $bxold[2]
dim $byold[2]
global $directionR = 1, $bxR = 500, $byR = 595, $movesR = 1
dim $bxoldR[2]
dim $byoldR[2]
$direction = 1
$directionR = 1
$inst = guictrlcreatelabel("Joueur contre Joueur" & @crlf & @crlf & "Vous ne pouvez pas passer à travers les murs.", 350, 200, 200, 75, $SS_CENTER)
$start = guictrlcreatebutton("Démarrer", 400,300,100,40)
guictrlcreatelabel("",$bx,$by,5,5)
guictrlsetbkcolor(-1, 0x0000FF)
guictrlcreatelabel("",$bxR,$byR,5,5)
guictrlsetbkcolor(-1, 0xFF0000)
guisetstate(@sw_show)
while 1
$msg = guigetmsg()
Select
case $msg = $gui_event_close
exit 0
Case $msg = $start
guictrldelete($start)
guictrlsetdata($inst, "Démarrage dans 3...")
sleep(500)
guictrlsetdata($inst, "Démarrage dans 2...")
sleep(500)
guictrlsetdata($inst, "Démarrage dans 1...")
sleep(500)
guictrlsetdata($inst, "C'est parti !")
sleep(500)
guictrldelete($inst)
oneplayer()
endselect
sleep(25)
wend
func oneplayer() ;PLAYERS = 1------asdasdasd----------------------------------------------------
;~ Joueur Bleu
hotkeyset("{z}", "up")
hotkeyset("{s}", "down")
hotkeyset("{q}", "left")
hotkeyset("{d}", "right")
;~ Joueur rouge
hotkeyset("{up}", "upr")
hotkeyset("{down}", "downr")
hotkeyset("{left}", "leftr")
hotkeyset("{right}", "rightr")
while 1
;blue BOX BELOW HERE------asdasdasd------------------------------------------------------------------
select ;1=up 2=down 3=left 4=right
case $direction = 1
$by -= 5 ;$by = 270
case $direction = 2
$by += 5
case $direction = 3
$bx -= 5
case $direction = 4
$bx += 5
endselect
guictrlcreatelabel("",$bx,$by,5,5)
guictrlsetbkcolor(-1, 0x0000FF)
for $i = 0 to ($moves-1) step 1
if (($by = $byold[$i]) and ($bx = $bxold[$i])) or (($by = $byoldR[$i]) and ($bx = $bxoldR[$i])) or (($bx > 890 or $bx < 0) or ($by > 590 or $by < 0)) then
msgbox(64, "Perdu", "Le joueur bleu à perdu !")
exit 0
endif
next
$moves += 1
redim $bxold[$moves+1]
redim $byold[$moves+1]
$bxold[$moves] = $bx
$byold[$moves] = $by
;Joueur Rouge
;red BOX BELOW HERE------asdasdasd------------------------------------------------------------------
select ;1=up 2=down 3=left 4=right
case $directionR = 1
$byR -= 5
case $directionR = 2
$byR += 5
case $directionR = 3
$bxR -= 5
case $directionR = 4
$bxR += 5
endselect
guictrlcreatelabel("",$bxR,$byR,5,5)
guictrlsetbkcolor(-1, 0xFF0000)
for $i = 0 to ($movesR-1) step 1
if (($byR = $byold[$i]) and ($bxR = $bxold[$i])) or ($byR = $byoldR[$i]) and ($bxR = $bxoldR[$i]) or (($bxR > 890 or $bxR < 0) or ($byR > 590 or $byR < 0)) then
msgbox(64, "Perdu", "Le joueur rouge à perdu !")
exit 0
endif
next
$movesR += 1
redim $bxoldR[$movesR+1]
redim $byoldR[$movesR+1]
$bxoldR[$movesR] = $bxR
$byoldR[$movesR] = $byR
sleep(25)
wend
endfunc
func up()
$direction = 1
endfunc
func down()
$direction = 2
endfunc
func left()
$direction = 3
endfunc
func right()
$direction = 4
endfunc
func upR()
$directionR = 1
endfunc
func downR()
$directionR = 2
endfunc
func leftR()
$directionR = 3
endfunc
func rightR()
$directionR = 4
endfuncJ'ai essayer de faire communiquer les information de position en écrivant des fichiers et que l'autre lisait mais sans succès.
Donc si quelqu'un sait comment faire...
Merci d'avance.


