PAC-MAN en Batch
Posté : 20 juin 2011 10:28
Bonjour à tous !
Voici un jeu type pac-man que j'ai écris il y a un moment déja, il nécessite la commande externe "key.exe" créée par Bilou de batch.xo.it :
http://www.box.net/shared/tfnq8ugqrutppoz15xqg
Bon jeu et bonne lecture du code ^^
N'hésitez pas à poster vos commentaires !
:: ------------------------------ CODE --------------------
@echo off
title )}--PAC_MAN--{( ^| Batch ^|
color 0E
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
if not exist key.exe (
echo Veuillez telecherger key.exe ...
start http://www.box.net/shared/tfnq8ugqrutppoz15xqg
pause
exit
)
:: ###############################################
:: #
:: #
:: ################ RESET GAME ################
:RESET
:: \\ %CVR% correspond a chaque "brique" du mur
set CVR=Û
:: \\ %PAC% est le personnage Pac-Man
set PAC=
:: \\ %GUM% est le personnage Pac-Gomme
set GUM=.
:: \\ %GHOST% est le personnage Fantome
set GHOST=
:: \\ %LIFE% est le personnage VIE
set LIFE=
:: \\ %NB_LIFE% est le nombre de Vies
set NB_LIFE=3
:: \\ %LVL_MAX% correspond aux niveaux construits
set LVL_MAX=4
:: ###############################################
:: #
:: #
:: ##################################----MENU----################################
:MENU
cls
echo. &echo.
echo ____ _ ____ __ __ _ _ _
echo ^| _ \ / \ / ___^| ^| \/ ^| / \ ^| \ ^| ^|
echo ^| ^|_) ^| / _ \ ^| ^| ^| ^|\/^| ^| / _ \ ^| \^| ^|
echo ^| __/ / ___ \ ^| ^|___ BATCH ^| ^| ^| ^| / ___ \ ^| ^|\ ^|
echo ^|_^| /_/ \_\ \____^| ^|_^| ^|_^| /_/ \_\ ^|_^| \_^|
echo. &echo. &echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º -- RŠgle du Jeu -- º
echo º º
echo º Utilisez les flŠches º
echo º pour diriger Pac-Man º
echo º º
echo º Espace pour sortir º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo. &echo.
set SCORE=0
set LVL=1
set /p LVL= Choix du Niveau [ 1 - %LVL_MAX% ] \\:
for /f "delims=1234" %%A in ("%LVL%") do (
goto :MENU
)
set LVL=:LEVEL_%LVL%
goto %LVL%
:: ############################################################################
:: #
:: #
:: ################ Initialisation du LEVEL_1 ################
:LEVEL_1
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Emplacement des Vies ------
set X16_Y11=%LIFE%
set TRANS_X16_Y11=%LIFE%
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=245
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for /l %%A in (6,1,8) do (
set X%%A_Y8=%CVR%
set X%%A_Y9=%CVR%
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
set X%%A_Y31=%CVR%
set X%%A_Y32=%CVR%
)
for /l %%A in (10,1,12) do (
set X%%A_Y8=%CVR%
set X%%A_Y9=%CVR%
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
set X%%A_Y31=%CVR%
set X%%A_Y32=%CVR%
)
for /l %%A in (8,1,10) do (
set X%%A_Y11=%CVR%
set X%%A_Y12=%CVR%
set X%%A_Y28=%CVR%
set X%%A_Y29=%CVR%
)
:: \\ Murs Horizontaux -------
for /l %%A in (3,1,6) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (2,1,6) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (34,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (34,1,38) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (8,1,15) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (25,1,32) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (17,1,23) do (
set X2_Y%%A=%CVR%
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
set X16_Y%%A=%CVR%
)
for /l %%A in (10,1,13) do (
set X6_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (27,1,30) do (
set X6_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
goto :WALL
:: ############################################################
:: #
:: #
:: ################ Initialisation du LEVEL_2 ################
:LEVEL_2
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Emplacement des Vies ------
set X2_Y28=%LIFE%
set TRANS_X2_Y28=%LIFE%
set X16_Y12=%LIFE%
set TRANS_X16_Y12=%LIFE%
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=186
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for /l %%A in (7,1,11) do (
set X%%A_Y3=%CVR%
set X%%A_Y4=%CVR%
set X%%A_Y5=%CVR%
set X%%A_Y35=%CVR%
set X%%A_Y36=%CVR%
set X%%A_Y37=%CVR%
)
for /l %%A in (3,1,6) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y12=%CVR%
set X%%A_Y30=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y28=%CVR%
)
for /l %%A in (12,1,15) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y12=%CVR%
set X%%A_Y30=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y28=%CVR%
)
for /l %%A in (5,1,8) do (
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
)
for /l %%A in (10,1,13) do (
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
)
for /l %%A in (3,1,5) do (
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
)
for /l %%A in (13,1,15) do (
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
)
:: \\ Murs Horizontaux -------
for /l %%A in (3,1,8) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X13_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (32,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X13_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (7,1,15) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (10,1,15) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (7,1,8) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (25,1,33) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (25,1,30) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (32,1,33) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (7,1,8) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (14,1,15) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (25,1,26) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (32,1,33) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (14,1,26) do (
set X2_Y%%A=%CVR%
set X3_Y%%A=%CVR%
set X15_Y%%A=%CVR%
set X16_Y%%A=%CVR%
)
for /l %%A in (10,1,15) do (
set X9_Y%%A=%CVR%
)
for /l %%A in (25,1,30) do (
set X9_Y%%A=%CVR%
)
for /l %%A in (15,1,24) do (
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X13_Y%%A=%CVR%
set X14_Y%%A=%CVR%
)
for /l %%A in (14,1,20) do (
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (19,1,26) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
)
goto :WALL
:: #####################################################
:: #
:: #
:: ################ Initialisation du LEVEL_3 ################
:LEVEL_3
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=188
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for /l %%A in (3,1,8) do (
for /l %%B in (3,1,14) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (10,1,15) do (
for /l %%B in (26,1,37) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (2,1,3) do (
for /l %%B in (16,1,19) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (5,1,8) do (
for /l %%B in (16,1,19) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (15,1,16) do (
for /l %%B in (21,1,24) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (10,1,13) do (
for /l %%B in (21,1,24) do (
set X%%A_Y%%B=%CVR%
))
:: \\ Murs Horizontaux -------
for /l %%A in (2,1,19) do (
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (21,1,38) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
)
for /l %%A in (3,1,19) do (
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (23,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
:: \\ Ajouts Correctifs -------
set X3_Y20=%CVR%
set X3_Y21=%CVR%
set X4_Y21=%CVR%
set X15_Y20=%CVR%
:: \\ Emplacement des Vies ------
set X2_Y19=%LIFE%
set TRANS_X2_Y19=%LIFE%
set X16_Y21=%LIFE%
set TRANS_X16_Y21=%LIFE%
goto :WALL
:: #####################################################
:: #
:: #
:: ################ Initialisation du LEVEL_4 ################
:LEVEL_4
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Emplacement des Vies ------
set X9_Y35=%LIFE%
set TRANS_X9_Y35=%LIFE%
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=167
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for %%A in (16) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y30=%CVR%
)
for %%A in (2) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y30=%CVR%
)
for /l %%A in (3,1,7) do (
set X%%A_Y19=%CVR%
set X%%A_Y20=%CVR%
set X%%A_Y21=%CVR%
)
for /l %%A in (11,1,15) do (
set X%%A_Y19=%CVR%
set X%%A_Y20=%CVR%
set X%%A_Y21=%CVR%
)
for /l %%A in (13,1,14) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
)
for /l %%A in (4,1,5) do (
set X%%A_Y29=%CVR%
set X%%A_Y30=%CVR%
)
:: \\ Murs Horizontaux -------
for /l %%A in (2,1,4) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (36,1,38) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (6,1,21) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (19,1,34) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (6,1,17) do (
set X9_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (23,1,34) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X9_Y%%A=%CVR%
)
for /l %%A in (3,1,8) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
for /l %%A in (6,1,18) do (
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
)
for /l %%A in (13,1,18) do (
set X3_Y%%A=%CVR%
)
for /l %%A in (22,1,27) do (
set X15_Y%%A=%CVR%
)
for /l %%A in (32,1,37) do (
set X15_Y%%A=%CVR%
)
for /l %%A in (22,1,37) do (
set X14_Y%%A=%CVR%
)
for /l %%A in (22,1,34) do (
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
set X13_Y%%A=%CVR%
)
for /l %%A in (23,1,27) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
for /l %%A in (32,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
for /l %%A in (3,1,8) do (
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (13,1,17) do (
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
goto :WALL
:: #####################################################
:: #
:: #
:: ####################################### WALL ####################################
:: \\ Grille de jeu _ Tous niveaux
:WALL
set LINE_21=
set LINE_20= %LVL%
set LINE_19=
set LINE_18= %X17_Y1%%X17_Y2%%X17_Y3%%X17_Y4%%X17_Y5%%X17_Y6%%X17_Y7%%X17_Y8%%X17_Y9%%X17_Y10%%X17_Y11%%X17_Y12%%X17_Y13%%X17_Y14%%X17_Y15%%X17_Y16%%X17_Y17%%X17_Y18%%X17_Y19%%X17_Y20%%X17_Y21%%X17_Y22%%X17_Y23%%X17_Y24%%X17_Y25%%X17_Y26%%X17_Y27%%X17_Y28%%X17_Y29%%X17_Y30%%X17_Y31%%X17_Y32%%X17_Y33%%X17_Y34%%X17_Y35%%X17_Y36%%X17_Y37%%X17_Y38%%X17_Y39%
set LINE_17= %X16_Y1%%X16_Y2%%X16_Y3%%X16_Y4%%X16_Y5%%X16_Y6%%X16_Y7%%X16_Y8%%X16_Y9%%X16_Y10%%X16_Y11%%X16_Y12%%X16_Y13%%X16_Y14%%X16_Y15%%X16_Y16%%X16_Y17%%X16_Y18%%X16_Y19%%X16_Y20%%X16_Y21%%X16_Y22%%X16_Y23%%X16_Y24%%X16_Y25%%X16_Y26%%X16_Y27%%X16_Y28%%X16_Y29%%X16_Y30%%X16_Y31%%X16_Y32%%X16_Y33%%X16_Y34%%X16_Y35%%X16_Y36%%X16_Y37%%X16_Y38%%X16_Y39%
set LINE_16= %X15_Y1%%X15_Y2%%X15_Y3%%X15_Y4%%X15_Y5%%X15_Y6%%X15_Y7%%X15_Y8%%X15_Y9%%X15_Y10%%X15_Y11%%X15_Y12%%X15_Y13%%X15_Y14%%X15_Y15%%X15_Y16%%X15_Y17%%X15_Y18%%X15_Y19%%X15_Y20%%X15_Y21%%X15_Y22%%X15_Y23%%X15_Y24%%X15_Y25%%X15_Y26%%X15_Y27%%X15_Y28%%X15_Y29%%X15_Y30%%X15_Y31%%X15_Y32%%X15_Y33%%X15_Y34%%X15_Y35%%X15_Y36%%X15_Y37%%X15_Y38%%X15_Y39%
set LINE_15= %X14_Y1%%X14_Y2%%X14_Y3%%X14_Y4%%X14_Y5%%X14_Y6%%X14_Y7%%X14_Y8%%X14_Y9%%X14_Y10%%X14_Y11%%X14_Y12%%X14_Y13%%X14_Y14%%X14_Y15%%X14_Y16%%X14_Y17%%X14_Y18%%X14_Y19%%X14_Y20%%X14_Y21%%X14_Y22%%X14_Y23%%X14_Y24%%X14_Y25%%X14_Y26%%X14_Y27%%X14_Y28%%X14_Y29%%X14_Y30%%X14_Y31%%X14_Y32%%X14_Y33%%X14_Y34%%X14_Y35%%X14_Y36%%X14_Y37%%X14_Y38%%X14_Y39%
set LINE_14= %X13_Y1%%X13_Y2%%X13_Y3%%X13_Y4%%X13_Y5%%X13_Y6%%X13_Y7%%X13_Y8%%X13_Y9%%X13_Y10%%X13_Y11%%X13_Y12%%X13_Y13%%X13_Y14%%X13_Y15%%X13_Y16%%X13_Y17%%X13_Y18%%X13_Y19%%X13_Y20%%X13_Y21%%X13_Y22%%X13_Y23%%X13_Y24%%X13_Y25%%X13_Y26%%X13_Y27%%X13_Y28%%X13_Y29%%X13_Y30%%X13_Y31%%X13_Y32%%X13_Y33%%X13_Y34%%X13_Y35%%X13_Y36%%X13_Y37%%X13_Y38%%X13_Y39%
set LINE_13= %X12_Y1%%X12_Y2%%X12_Y3%%X12_Y4%%X12_Y5%%X12_Y6%%X12_Y7%%X12_Y8%%X12_Y9%%X12_Y10%%X12_Y11%%X12_Y12%%X12_Y13%%X12_Y14%%X12_Y15%%X12_Y16%%X12_Y17%%X12_Y18%%X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2_Y3%%X2_Y4%%X2_Y5%%X2_Y6%%X2_Y7%%X2_Y8%%X2_Y9%%X2_Y10%%X2_Y11%%X2_Y12%%X2_Y13%%X2_Y14%%X2_Y15%%X2_Y16%%X2_Y17%%X2_Y18%%X2_Y19%%X2_Y20%%X2_Y21%%X2_Y22%%X2_Y23%%X2_Y24%%X2_Y25%%X2_Y26%%X2_Y27%%X2_Y28%%X2_Y29%%X2_Y30%%X2_Y31%%X2_Y32%%X2_Y33%%X2_Y34%%X2_Y35%%X2_Y36%%X2_Y37%%X2_Y38%%X2_Y39%
set LINE_2= %X1_Y1%%X1_Y2%%X1_Y3%%X1_Y4%%X1_Y5%%X1_Y6%%X1_Y7%%X1_Y8%%X1_Y9%%X1_Y10%%X1_Y11%%X1_Y12%%X1_Y13%%X1_Y14%%X1_Y15%%X1_Y16%%X1_Y17%%X1_Y18%%X1_Y19%%X1_Y20%%X1_Y21%%X1_Y22%%X1_Y23%%X1_Y24%%X1_Y25%%X1_Y26%%X1_Y27%%X1_Y28%%X1_Y29%%X1_Y30%%X1_Y31%%X1_Y32%%X1_Y33%%X1_Y34%%X1_Y35%%X1_Y36%%X1_Y37%%X1_Y38%%X1_Y39%
set LINE_1= [ LIFES: %NB_LIFE% ] - [ SCORE: %SCORE% ]
cls
for /l %%A in (21,-1,1) do echo.!Line_%%A!
:: ################
:: PAUSE
:: ################
call :USE_KEY
goto :MOVE_PAC
:: #################################################################################
:: #
:: #
:: ######################## --- Définition des Mouvements --- ########################
:MOVE_PAC
for /f "delims=ULRDS" %%A in ("%TOUCH%") do (
goto :END_MOVE
)
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_PAC%") do (
set ExX=%%X
set ExY=%%Y
)
if %TOUCH%==S goto :RESET
if %TOUCH%==U set /a NwX=ExX+1
if %TOUCH%==U (
set NEW_POS_PAC=X%NwX%_Y%ExY%
goto :VERIF
)
if %TOUCH%==L set /a NwY=ExY-1
if %TOUCH%==L (
set NEW_POS_PAC=X%ExX%_Y%NwY%
goto :VERIF
)
if %TOUCH%==R set /a NwY=ExY+1
if %TOUCH%==R (
set NEW_POS_PAC=X%ExX%_Y%NwY%
goto :VERIF
)
if %TOUCH%==D set /a NwX=ExX-1
if %TOUCH%==D (
set NEW_POS_PAC=X%NwX%_Y%ExY%
goto :VERIF
)
:VERIF
if %NEW_POS_PAC%==X9_Y0 set NEW_POS_PAC=X9_Y39
if %NEW_POS_PAC%==X9_Y40 set NEW_POS_PAC=X9_Y1
for /f "tokens=*" %%A in ("%NEW_POS_PAC%") do (
set CORR=%%A
)
if !%CORR%! EQU %CVR% goto :END_MOVE
if !%CORR%! EQU %GUM% (
set /a NB_GUM=NB_GUM+1
set /a SCORE=SCORE+1
)
if !%CORR%! EQU %LIFE% set /a NB_LIFE=NB_LIFE+1
if !%CORR%! EQU %GHOST% goto :LOSE
set "%EX_POS_PAC%= "
for /f "tokens=*" %%A in ("%EX_POS_PAC%") do (
set "TRANS_%%A= "
)
set EX_POS_PAC=%NEW_POS_PAC%
set %NEW_POS_PAC%=%PAC%
if %NB_GUM% EQU %MAX_GUM% goto :END_LEVEL
:END_MOVE
goto :WALL
:: ############################################################################
:: #
:: #
:: ######################## ---LOSE--- ########################
:LOSE
set /a NB_LIFE=NB_LIFE-1
if %NB_LIFE%==0 goto :GAME_OVER
:: \\ Nouvel Emplacement du PAC-MAN ------
set "%EX_POS_PAC%= "
set NEW_POS_PAC=X9_Y20
set EX_POS_PAC=%NEW_POS_PAC%
set %NEW_POS_PAC%=%PAC%
cls
echo. &echo. &echo. &echo. &echo. &echo.
echo __ __ ___ _ _ _ ___ ____ _____
echo \ \ / / / _ \ ^| ^| ^| ^| ^| ^| / _ \ / ___^| ^|_ _^|
echo \ V / ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| \___ \ ^| ^|
echo ^| ^| ^| ^|_^| ^| ^| ^|_^| ^| ^| ^|___ ^| ^|_^| ^| ___) ^| ^| ^|
echo ^|_^| \___/ \___/ ^|_____^| \___/ ^|____/ ^|_^|
echo.
echo ___ _ _ _____ _ ___ _____ _____
echo / _ \ ^| \ ^| ^| ^| ____^| ^| ^| ^|_ _^| ^| ___^| ^| ____^|
echo ^| ^| ^| ^| ^| \^| ^| ^| _^| ^| ^| ^| ^| ^| ^|_ ^| _^|
echo ^| ^|_^| ^| ^| ^|\ ^| ^| ^|___ ^| ^|___ ^| ^| ^| _^| ^| ^|___
echo \___/ ^|_^| \_^| ^|_____^| ^|_____^| ^|___^| ^|_^| ^|_____^|
echo.
echo -- Still %NB_LIFE% Lifes --
echo. &echo. &echo.
echo Press any key to continue the game ...
pause>nul
pause>nul
goto :WALL
:: ##############################################################
:: #
:: #
:: ######################## ---GAME-OVER--- ########################
:GAME_OVER
cls
echo. &echo. &echo. &echo. &echo. &echo. &echo. &echo.
echo ____ _ __ __ _____ ___ __ __ _____ ____
echo / ___^| / \ ^| \/ ^| ^| ____^| / _ \ \ \ / / ^| ____^| ^| _ \
echo ^| ^| _ / _ \ ^| ^|\/^| ^| ^| _^| ^| ^| ^| ^| \ \ / / ^| _^| ^| ^|_) ^|
echo ^| ^|_^| ^| / ___ \ ^| ^| ^| ^| ^| ^|___ ^| ^|_^| ^| \ V / ^| ^|___ ^| _ ^<
echo \____^| /_/ \_\ ^|_^| ^|_^| ^|_____^| \___/ \_/ ^|_____^| ^|_^| \_\
echo.
echo -- You are a LOSER --
echo. &echo. &echo. &echo. &echo. &echo. &echo.
echo Press any key to restart the game ...
pause>nul
pause>nul
goto :RESET
:: ##############################################################
:: #
:: #
:: ######################## ---END-LEVEL--- ########################
:END_LEVEL
cls
for /f "tokens=* delims=:LEVEL_" %%A in ("%LVL%") do (
set /a NEXT=%%A+1
)
set LVL=:LEVEL_%NEXT%
echo. &echo. &echo. &echo. &echo.
echo _ _____ __ __ _____ _
echo ^| ^| ^| ____^| \ \ / / ^| ____^| ^| ^|
echo ^| ^| ^| _^| \ \ / / ^| _^| ^| ^|
echo ^| ^|___ ^| ^|___ \ V / ^| ^|___ ^| ^|___
echo ^|_____^| ^|_____^| \_/ ^|_____^| ^|_____^|
echo ____ ___ __ __ ____ _ _____ _____ _____ ____
echo / ___^| / _ \ ^| \/ ^| ^| _ \ ^| ^| ^| ____^| ^|_ _^| ^| ____^| ^| _ \
echo ^| ^| ^| ^| ^| ^| ^| ^|\/^| ^| ^| ^|_) ^| ^| ^| ^| _^| ^| ^| ^| _^| ^| ^| ^| ^|
echo ^| ^|___ ^| ^|_^| ^| ^| ^| ^| ^| ^| __/ ^| ^|___ ^| ^|___ ^| ^| ^| ^|___ ^| ^|_^| ^|
echo \____^| \___/ ^|_^| ^|_^| ^|_^| ^|_____^| ^|_____^| ^|_^| ^|_____^| ^|____/
echo.
echo -- CONGRATULATION --
echo. &echo. &echo. &echo. &echo.
echo Press any key to continue the game ...
pause>nul
pause>nul
if %NEXT% GTR %LVL_MAX% goto :LAST_LEVEL
goto :LEVEL_%NEXT%
:: ###################################################################
:: #
:: #
:: ######################## ---LAST-LEVEL--- ########################
:LAST_LEVEL
cls
echo. &echo. &echo. &echo. &echo. &echo.
echo -- LAST LEVEL COMPLETED --
echo.
echo __ __ ___ _ _ __ __ ___ _ _
echo \ \ / / / _ \ ^| ^| ^| ^| \ \ / / ^|_ _^| ^| \ ^| ^|
echo \ V / ^| ^| ^| ^| ^| ^| ^| ^| \ \ /\ / / ^| ^| ^| \^| ^|
echo ^| ^| ^| ^|_^| ^| ^| ^|_^| ^| \ V V / ^| ^| ^| ^|\ ^|
echo ^|_^| \___/ \___/ \_/\_/ ^|___^| ^|_^| \_^|
echo.
echo [ SCORE: %SCORE% ]
echo. &echo. &echo. &echo. &echo. &echo. &echo. &echo.
echo Press any key to restart the game ...
pause>nul
pause>nul
goto :RESET
:: ###################################################################
:: #
:: #
:: ######################## --- Table ERRORLEVEL de KEY --- ########################
:USE_KEY
key
call :MOVE_GHOSTS
if %errorlevel%==72 set TOUCH=U
if %errorlevel%==75 set TOUCH=L
if %errorlevel%==77 set TOUCH=R
if %errorlevel%==80 set TOUCH=D
if %errorlevel%==32 set TOUCH=S
goto :EOF
:: ###################################################################
:: #
:: #
:: ######################## ---Déplacement de Fantômes--- ########################
:MOVE_GHOSTS
:: \\ Déplacement Ghost_1 ------------------
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G1%") do (
set Ex_X_G1=%%X
set Ex_Y_G1=%%Y
)
set /a DIRECT_X_G1 = Ex_X_G1 %OP_G1% 1
set /a DIRECT_Y_G1 = Ex_Y_G1 %OP_G1% 1
:RE-GHOSTS_G1
set NEW_POS_G1=X%DIRECT_X_G1%_Y%Ex_Y_G1%
for /f "tokens=*" %%A in ("%NEW_POS_G1%") do (
set CORR_G1=%%A
)
if !%CORR_G1%!==%CVR% goto :JUMP_G1A
if !%CORR_G1%!==%PAC% goto :LOSE
if %NEW_POS_G1%==X9_Y0 set NEW_POS_G1=X9_Y39
if %NEW_POS_G1%==X9_Y40 set NEW_POS_G1=X9_Y1
set "%EX_POS_G1%=!TRANS_%EX_POS_G1%!"
set "EX_POS_G1=%NEW_POS_G1%"
set "%NEW_POS_G1%=%GHOST%"
goto :END_MOVE_GHOSTS_G1
:JUMP_G1A
set NEW_POS_G1=X%Ex_X_G1%_Y%DIRECT_Y_G1%
for /f "tokens=*" %%A in ("%NEW_POS_G1%") do (
set CORR_G1=%%A
)
if !%CORR_G1%!==%CVR% goto :JUMP_G1B
if !%CORR_G1%!==%PAC% goto :LOSE
if %NEW_POS_G1%==X9_Y0 set NEW_POS_G1=X9_Y39
if %NEW_POS_G1%==X9_Y40 set NEW_POS_G1=X9_Y1
set "%EX_POS_G1%=!TRANS_%EX_POS_G1%!"
set "EX_POS_G1=%NEW_POS_G1%"
set "%NEW_POS_G1%=%GHOST%"
goto :END_MOVE_GHOSTS_G1
:JUMP_G1B
if %OP_G1%==+ (
set "OP_G1=-"
) else (
set "OP_G1=+"
)
set /a DIRECT_X_G1 = Ex_X_G1 %OP_G1% 1
set /a DIRECT_Y_G1 = Ex_Y_G1 %OP_G1% 1
goto :RE-GHOSTS_G1
:END_MOVE_GHOSTS_G1
:: ########## end ghost 1 ---
:: \\ Déplacement Ghost_2
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G2%") do (
set Ex_X_G2=%%X
set Ex_Y_G2=%%Y
)
set /a DIRECT_X_G2 = Ex_X_G2 %OP_G2% 1
set /a DIRECT_Y_G2 = Ex_Y_G2 %OP_G2% 1
:RE-GHOSTS_G2
set NEW_POS_G2=X%DIRECT_X_G2%_Y%Ex_Y_G2%
for /f "tokens=*" %%A in ("%NEW_POS_G2%") do (
set CORR_G2=%%A
)
if !%CORR_G2%!==%CVR% goto :JUMP_G2A
if !%CORR_G2%!==%PAC% goto :LOSE
if %NEW_POS_G2%==X9_Y0 set NEW_POS_G2=X9_Y39
if %NEW_POS_G2%==X9_Y40 set NEW_POS_G2=X9_Y1
set "%EX_POS_G2%=!TRANS_%EX_POS_G2%!"
set "EX_POS_G2=%NEW_POS_G2%"
set "%NEW_POS_G2%=%GHOST%"
goto :END_MOVE_GHOSTS_G2
:JUMP_G2A
set NEW_POS_G2=X%Ex_X_G2%_Y%DIRECT_Y_G2%
for /f "tokens=*" %%A in ("%NEW_POS_G2%") do (
set CORR_G2=%%A
)
if !%CORR_G2%!==%CVR% goto :JUMP_G2B
if !%CORR_G2%!==%PAC% goto :LOSE
if %NEW_POS_G2%==X9_Y0 set NEW_POS_G2=X9_Y39
if %NEW_POS_G2%==X9_Y40 set NEW_POS_G2=X9_Y1
set "%EX_POS_G2%=!TRANS_%EX_POS_G2%!"
set "EX_POS_G2=%NEW_POS_G2%"
set "%NEW_POS_G2%=%GHOST%"
goto :END_MOVE_GHOSTS_G2
:JUMP_G2B
if %OP_G2%==+ (
set "OP_G2=-"
) else (
set "OP_G2=+"
)
set /a DIRECT_X_G2 = Ex_X_G2 %OP_G2% 1
set /a DIRECT_Y_G2 = Ex_Y_G2 %OP_G2% 1
goto :RE-GHOSTS_G2
:END_MOVE_GHOSTS_G2
:: ########## end ghost 2 ---
:: \\ Déplacement Ghost_3
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G3%") do (
set Ex_X_G3=%%X
set Ex_Y_G3=%%Y
)
set /a DIRECT_X_G3 = Ex_X_G3 %OP_G3% 1
set /a DIRECT_Y_G3 = Ex_Y_G3 %OP_G3% 1
:RE-GHOSTS_G3
set NEW_POS_G3=X%Ex_X_G3%_Y%DIRECT_Y_G3%
for /f "tokens=*" %%A in ("%NEW_POS_G3%") do (
set CORR_G3=%%A
)
if !%CORR_G3%!==%CVR% goto :JUMP_G3A
if !%CORR_G3%!==%PAC% goto :LOSE
if %NEW_POS_G3%==X9_Y0 set NEW_POS_G3=X9_Y39
if %NEW_POS_G3%==X9_Y40 set NEW_POS_G3=X9_Y1
set "%EX_POS_G3%=!TRANS_%EX_POS_G3%!"
set "EX_POS_G3=%NEW_POS_G3%"
set "%NEW_POS_G3%=%GHOST%"
goto :END_MOVE_GHOSTS_G3
:JUMP_G3A
set NEW_POS_G3=X%DIRECT_X_G3%_Y%Ex_Y_G3%
for /f "tokens=*" %%A in ("%NEW_POS_G3%") do (
set CORR_G3=%%A
)
if !%CORR_G3%!==%CVR% goto :JUMP_G3B
if !%CORR_G3%!==%PAC% goto :LOSE
if %NEW_POS_G3%==X9_Y0 set NEW_POS_G3=X9_Y39
if %NEW_POS_G3%==X9_Y40 set NEW_POS_G3=X9_Y1
set "%EX_POS_G3%=!TRANS_%EX_POS_G3%!"
set "EX_POS_G3=%NEW_POS_G3%"
set "%NEW_POS_G3%=%GHOST%"
goto :END_MOVE_GHOSTS_G3
:JUMP_G3B
if %OP_G3%==+ (
set "OP_G3=-"
) else (
set "OP_G3=+"
)
set /a DIRECT_X_G3 = Ex_X_G3 %OP_G3% 1
set /a DIRECT_Y_G3 = Ex_Y_G3 %OP_G3% 1
goto :RE-GHOSTS_G3
:END_MOVE_GHOSTS_G3
:: ########## end ghost 3 ---
:: \\ Déplacement Ghost_4
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G4%") do (
set Ex_X_G4=%%X
set Ex_Y_G4=%%Y
)
set /a DIRECT_X_G4 = Ex_X_G4 %OP_G4% 1
set /a DIRECT_Y_G4 = Ex_Y_G4 %OP_G4% 1
:RE-GHOSTS_G4
set NEW_POS_G4=X%DIRECT_X_G4%_Y%Ex_Y_G4%
for /f "tokens=*" %%A in ("%NEW_POS_G4%") do (
set CORR_G4=%%A
)
if !%CORR_G4%!==%CVR% goto :JUMP_G4A
if !%CORR_G4%!==%PAC% goto :LOSE
if %NEW_POS_G4%==X9_Y0 set NEW_POS_G4=X9_Y39
if %NEW_POS_G4%==X9_Y40 set NEW_POS_G4=X9_Y1
set "%EX_POS_G4%=!TRANS_%EX_POS_G4%!"
set "EX_POS_G4=%NEW_POS_G4%"
set "%NEW_POS_G4%=%GHOST%"
goto :END_MOVE_GHOSTS_G4
:JUMP_G4A
set NEW_POS_G4=X%Ex_X_G4%_Y%DIRECT_Y_G4%
for /f "tokens=*" %%A in ("%NEW_POS_G4%") do (
set CORR_G4=%%A
)
if !%CORR_G4%!==%CVR% goto :JUMP_G4B
if !%CORR_G4%!==%PAC% goto :LOSE
if %NEW_POS_G4%==X9_Y0 set NEW_POS_G4=X9_Y39
if %NEW_POS_G4%==X9_Y40 set NEW_POS_G4=X9_Y1
set "%EX_POS_G4%=!TRANS_%EX_POS_G4%!"
set "EX_POS_G4=%NEW_POS_G4%"
set "%NEW_POS_G4%=%GHOST%"
goto :END_MOVE_GHOSTS_G4
:JUMP_G4B
if %OP_G4%==+ (
set "OP_G4=-"
) else (
set "OP_G4=+"
)
set /a DIRECT_X_G4 = Ex_X_G4 %OP_G4% 1
set /a DIRECT_Y_G4 = Ex_Y_G4 %OP_G4% 1
goto :RE-GHOSTS_G4
:END_MOVE_GHOSTS_G4
:: ########## end ghost 4 ---
goto :EOF
:: ###################################################################
:: ------------------------------ CODE --------------------
Voici un jeu type pac-man que j'ai écris il y a un moment déja, il nécessite la commande externe "key.exe" créée par Bilou de batch.xo.it :
http://www.box.net/shared/tfnq8ugqrutppoz15xqg
Bon jeu et bonne lecture du code ^^
N'hésitez pas à poster vos commentaires !
:: ------------------------------ CODE --------------------
@echo off
title )}--PAC_MAN--{( ^| Batch ^|
color 0E
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
if not exist key.exe (
echo Veuillez telecherger key.exe ...
start http://www.box.net/shared/tfnq8ugqrutppoz15xqg
pause
exit
)
:: ###############################################
:: #
:: #
:: ################ RESET GAME ################
:RESET
:: \\ %CVR% correspond a chaque "brique" du mur
set CVR=Û
:: \\ %PAC% est le personnage Pac-Man
set PAC=
:: \\ %GUM% est le personnage Pac-Gomme
set GUM=.
:: \\ %GHOST% est le personnage Fantome
set GHOST=
:: \\ %LIFE% est le personnage VIE
set LIFE=
:: \\ %NB_LIFE% est le nombre de Vies
set NB_LIFE=3
:: \\ %LVL_MAX% correspond aux niveaux construits
set LVL_MAX=4
:: ###############################################
:: #
:: #
:: ##################################----MENU----################################
:MENU
cls
echo. &echo.
echo ____ _ ____ __ __ _ _ _
echo ^| _ \ / \ / ___^| ^| \/ ^| / \ ^| \ ^| ^|
echo ^| ^|_) ^| / _ \ ^| ^| ^| ^|\/^| ^| / _ \ ^| \^| ^|
echo ^| __/ / ___ \ ^| ^|___ BATCH ^| ^| ^| ^| / ___ \ ^| ^|\ ^|
echo ^|_^| /_/ \_\ \____^| ^|_^| ^|_^| /_/ \_\ ^|_^| \_^|
echo. &echo. &echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º -- RŠgle du Jeu -- º
echo º º
echo º Utilisez les flŠches º
echo º pour diriger Pac-Man º
echo º º
echo º Espace pour sortir º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo. &echo.
set SCORE=0
set LVL=1
set /p LVL= Choix du Niveau [ 1 - %LVL_MAX% ] \\:
for /f "delims=1234" %%A in ("%LVL%") do (
goto :MENU
)
set LVL=:LEVEL_%LVL%
goto %LVL%
:: ############################################################################
:: #
:: #
:: ################ Initialisation du LEVEL_1 ################
:LEVEL_1
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Emplacement des Vies ------
set X16_Y11=%LIFE%
set TRANS_X16_Y11=%LIFE%
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=245
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for /l %%A in (6,1,8) do (
set X%%A_Y8=%CVR%
set X%%A_Y9=%CVR%
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
set X%%A_Y31=%CVR%
set X%%A_Y32=%CVR%
)
for /l %%A in (10,1,12) do (
set X%%A_Y8=%CVR%
set X%%A_Y9=%CVR%
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
set X%%A_Y31=%CVR%
set X%%A_Y32=%CVR%
)
for /l %%A in (8,1,10) do (
set X%%A_Y11=%CVR%
set X%%A_Y12=%CVR%
set X%%A_Y28=%CVR%
set X%%A_Y29=%CVR%
)
:: \\ Murs Horizontaux -------
for /l %%A in (3,1,6) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (2,1,6) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (34,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (34,1,38) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (8,1,15) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (25,1,32) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (17,1,23) do (
set X2_Y%%A=%CVR%
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
set X16_Y%%A=%CVR%
)
for /l %%A in (10,1,13) do (
set X6_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (27,1,30) do (
set X6_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
goto :WALL
:: ############################################################
:: #
:: #
:: ################ Initialisation du LEVEL_2 ################
:LEVEL_2
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Emplacement des Vies ------
set X2_Y28=%LIFE%
set TRANS_X2_Y28=%LIFE%
set X16_Y12=%LIFE%
set TRANS_X16_Y12=%LIFE%
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=186
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for /l %%A in (7,1,11) do (
set X%%A_Y3=%CVR%
set X%%A_Y4=%CVR%
set X%%A_Y5=%CVR%
set X%%A_Y35=%CVR%
set X%%A_Y36=%CVR%
set X%%A_Y37=%CVR%
)
for /l %%A in (3,1,6) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y12=%CVR%
set X%%A_Y30=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y28=%CVR%
)
for /l %%A in (12,1,15) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y12=%CVR%
set X%%A_Y30=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y28=%CVR%
)
for /l %%A in (5,1,8) do (
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
)
for /l %%A in (10,1,13) do (
set X%%A_Y17=%CVR%
set X%%A_Y18=%CVR%
set X%%A_Y19=%CVR%
set X%%A_Y21=%CVR%
set X%%A_Y22=%CVR%
set X%%A_Y23=%CVR%
)
for /l %%A in (3,1,5) do (
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
)
for /l %%A in (13,1,15) do (
set X%%A_Y14=%CVR%
set X%%A_Y15=%CVR%
set X%%A_Y25=%CVR%
set X%%A_Y26=%CVR%
)
:: \\ Murs Horizontaux -------
for /l %%A in (3,1,8) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X13_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (32,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X13_Y%%A=%CVR%
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (7,1,15) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (10,1,15) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (7,1,8) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (25,1,33) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (25,1,30) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (32,1,33) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (7,1,8) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (14,1,15) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (25,1,26) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (32,1,33) do (
set X7_Y%%A=%CVR%
set X11_Y%%A=%CVR%
)
for /l %%A in (14,1,26) do (
set X2_Y%%A=%CVR%
set X3_Y%%A=%CVR%
set X15_Y%%A=%CVR%
set X16_Y%%A=%CVR%
)
for /l %%A in (10,1,15) do (
set X9_Y%%A=%CVR%
)
for /l %%A in (25,1,30) do (
set X9_Y%%A=%CVR%
)
for /l %%A in (15,1,24) do (
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X13_Y%%A=%CVR%
set X14_Y%%A=%CVR%
)
for /l %%A in (14,1,20) do (
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (19,1,26) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
)
goto :WALL
:: #####################################################
:: #
:: #
:: ################ Initialisation du LEVEL_3 ################
:LEVEL_3
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=188
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for /l %%A in (3,1,8) do (
for /l %%B in (3,1,14) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (10,1,15) do (
for /l %%B in (26,1,37) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (2,1,3) do (
for /l %%B in (16,1,19) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (5,1,8) do (
for /l %%B in (16,1,19) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (15,1,16) do (
for /l %%B in (21,1,24) do (
set X%%A_Y%%B=%CVR%
))
for /l %%A in (10,1,13) do (
for /l %%B in (21,1,24) do (
set X%%A_Y%%B=%CVR%
))
:: \\ Murs Horizontaux -------
for /l %%A in (2,1,19) do (
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (21,1,38) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
)
for /l %%A in (3,1,19) do (
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (23,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
:: \\ Ajouts Correctifs -------
set X3_Y20=%CVR%
set X3_Y21=%CVR%
set X4_Y21=%CVR%
set X15_Y20=%CVR%
:: \\ Emplacement des Vies ------
set X2_Y19=%LIFE%
set TRANS_X2_Y19=%LIFE%
set X16_Y21=%LIFE%
set TRANS_X16_Y21=%LIFE%
goto :WALL
:: #####################################################
:: #
:: #
:: ################ Initialisation du LEVEL_4 ################
:LEVEL_4
:: \\ Reset déplacement du Pac-Man
set TOUCH=UNDEFINED
:: \\ Initialisation des PAC-GOMMES Tous Niveaux
for /l %%A in (1,1,17) do (
for /l %%B in (1,1,39) do (
set "X%%A_Y%%B=%GUM%"
set "TRANS_X%%A_Y%%B=%GUM%"
)
)
:: \\ Emplacement du PAC-MAN ------
set EX_POS_PAC=X9_Y20
set %EX_POS_PAC%=%PAC%
:: \\ Emplacement des Fantomes
set EX_POS_G1=X2_Y2
set %EX_POS_G1%=%GHOST%
set "OP_G1=+"
set EX_POS_G2=X2_Y38
set %EX_POS_G2%=%GHOST%
set "OP_G2=+"
set EX_POS_G3=X16_Y2
set %EX_POS_G3%=%GHOST%
set "OP_G3=+"
set EX_POS_G4=X16_Y38
set %EX_POS_G4%=%GHOST%
set "OP_G4=+"
:: \\ Emplacement des Vies ------
set X9_Y35=%LIFE%
set TRANS_X9_Y35=%LIFE%
:: \\ Nombres de PAC-GOMMES
set NB_GUM=0
set MAX_GUM=167
:: \\ Murs du Contour -------
for /l %%A in (1,1,8) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (10,1,17) do (
set X%%A_Y1=%CVR%
set X%%A_Y39=%CVR%
)
for /l %%A in (1,1,39) do (
set X1_Y%%A=%CVR%
set X17_Y%%A=%CVR%
)
:: \\ Murs Verticaux -------
for %%A in (16) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y30=%CVR%
)
for %%A in (2) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
set X%%A_Y29=%CVR%
set X%%A_Y30=%CVR%
)
for /l %%A in (3,1,7) do (
set X%%A_Y19=%CVR%
set X%%A_Y20=%CVR%
set X%%A_Y21=%CVR%
)
for /l %%A in (11,1,15) do (
set X%%A_Y19=%CVR%
set X%%A_Y20=%CVR%
set X%%A_Y21=%CVR%
)
for /l %%A in (13,1,14) do (
set X%%A_Y10=%CVR%
set X%%A_Y11=%CVR%
)
for /l %%A in (4,1,5) do (
set X%%A_Y29=%CVR%
set X%%A_Y30=%CVR%
)
:: \\ Murs Horizontaux -------
for /l %%A in (2,1,4) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (36,1,38) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (6,1,21) do (
set X8_Y%%A=%CVR%
)
for /l %%A in (19,1,34) do (
set X10_Y%%A=%CVR%
)
for /l %%A in (6,1,17) do (
set X9_Y%%A=%CVR%
set X10_Y%%A=%CVR%
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
)
for /l %%A in (23,1,34) do (
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
set X8_Y%%A=%CVR%
set X9_Y%%A=%CVR%
)
for /l %%A in (3,1,8) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
for /l %%A in (6,1,18) do (
set X4_Y%%A=%CVR%
set X5_Y%%A=%CVR%
set X6_Y%%A=%CVR%
set X7_Y%%A=%CVR%
)
for /l %%A in (13,1,18) do (
set X3_Y%%A=%CVR%
)
for /l %%A in (22,1,27) do (
set X15_Y%%A=%CVR%
)
for /l %%A in (32,1,37) do (
set X15_Y%%A=%CVR%
)
for /l %%A in (22,1,37) do (
set X14_Y%%A=%CVR%
)
for /l %%A in (22,1,34) do (
set X11_Y%%A=%CVR%
set X12_Y%%A=%CVR%
set X13_Y%%A=%CVR%
)
for /l %%A in (23,1,27) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
for /l %%A in (32,1,37) do (
set X3_Y%%A=%CVR%
set X4_Y%%A=%CVR%
)
for /l %%A in (3,1,8) do (
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
for /l %%A in (13,1,17) do (
set X14_Y%%A=%CVR%
set X15_Y%%A=%CVR%
)
goto :WALL
:: #####################################################
:: #
:: #
:: ####################################### WALL ####################################
:: \\ Grille de jeu _ Tous niveaux
:WALL
set LINE_21=
set LINE_20= %LVL%
set LINE_19=
set LINE_18= %X17_Y1%%X17_Y2%%X17_Y3%%X17_Y4%%X17_Y5%%X17_Y6%%X17_Y7%%X17_Y8%%X17_Y9%%X17_Y10%%X17_Y11%%X17_Y12%%X17_Y13%%X17_Y14%%X17_Y15%%X17_Y16%%X17_Y17%%X17_Y18%%X17_Y19%%X17_Y20%%X17_Y21%%X17_Y22%%X17_Y23%%X17_Y24%%X17_Y25%%X17_Y26%%X17_Y27%%X17_Y28%%X17_Y29%%X17_Y30%%X17_Y31%%X17_Y32%%X17_Y33%%X17_Y34%%X17_Y35%%X17_Y36%%X17_Y37%%X17_Y38%%X17_Y39%
set LINE_17= %X16_Y1%%X16_Y2%%X16_Y3%%X16_Y4%%X16_Y5%%X16_Y6%%X16_Y7%%X16_Y8%%X16_Y9%%X16_Y10%%X16_Y11%%X16_Y12%%X16_Y13%%X16_Y14%%X16_Y15%%X16_Y16%%X16_Y17%%X16_Y18%%X16_Y19%%X16_Y20%%X16_Y21%%X16_Y22%%X16_Y23%%X16_Y24%%X16_Y25%%X16_Y26%%X16_Y27%%X16_Y28%%X16_Y29%%X16_Y30%%X16_Y31%%X16_Y32%%X16_Y33%%X16_Y34%%X16_Y35%%X16_Y36%%X16_Y37%%X16_Y38%%X16_Y39%
set LINE_16= %X15_Y1%%X15_Y2%%X15_Y3%%X15_Y4%%X15_Y5%%X15_Y6%%X15_Y7%%X15_Y8%%X15_Y9%%X15_Y10%%X15_Y11%%X15_Y12%%X15_Y13%%X15_Y14%%X15_Y15%%X15_Y16%%X15_Y17%%X15_Y18%%X15_Y19%%X15_Y20%%X15_Y21%%X15_Y22%%X15_Y23%%X15_Y24%%X15_Y25%%X15_Y26%%X15_Y27%%X15_Y28%%X15_Y29%%X15_Y30%%X15_Y31%%X15_Y32%%X15_Y33%%X15_Y34%%X15_Y35%%X15_Y36%%X15_Y37%%X15_Y38%%X15_Y39%
set LINE_15= %X14_Y1%%X14_Y2%%X14_Y3%%X14_Y4%%X14_Y5%%X14_Y6%%X14_Y7%%X14_Y8%%X14_Y9%%X14_Y10%%X14_Y11%%X14_Y12%%X14_Y13%%X14_Y14%%X14_Y15%%X14_Y16%%X14_Y17%%X14_Y18%%X14_Y19%%X14_Y20%%X14_Y21%%X14_Y22%%X14_Y23%%X14_Y24%%X14_Y25%%X14_Y26%%X14_Y27%%X14_Y28%%X14_Y29%%X14_Y30%%X14_Y31%%X14_Y32%%X14_Y33%%X14_Y34%%X14_Y35%%X14_Y36%%X14_Y37%%X14_Y38%%X14_Y39%
set LINE_14= %X13_Y1%%X13_Y2%%X13_Y3%%X13_Y4%%X13_Y5%%X13_Y6%%X13_Y7%%X13_Y8%%X13_Y9%%X13_Y10%%X13_Y11%%X13_Y12%%X13_Y13%%X13_Y14%%X13_Y15%%X13_Y16%%X13_Y17%%X13_Y18%%X13_Y19%%X13_Y20%%X13_Y21%%X13_Y22%%X13_Y23%%X13_Y24%%X13_Y25%%X13_Y26%%X13_Y27%%X13_Y28%%X13_Y29%%X13_Y30%%X13_Y31%%X13_Y32%%X13_Y33%%X13_Y34%%X13_Y35%%X13_Y36%%X13_Y37%%X13_Y38%%X13_Y39%
set LINE_13= %X12_Y1%%X12_Y2%%X12_Y3%%X12_Y4%%X12_Y5%%X12_Y6%%X12_Y7%%X12_Y8%%X12_Y9%%X12_Y10%%X12_Y11%%X12_Y12%%X12_Y13%%X12_Y14%%X12_Y15%%X12_Y16%%X12_Y17%%X12_Y18%%X12_Y19%%X12_Y20%%X12_Y21%%X12_Y22%%X12_Y23%%X12_Y24%%X12_Y25%%X12_Y26%%X12_Y27%%X12_Y28%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%X2_Y13%%X2_Y14%%X2_Y15%%X2_Y16%%X2_Y17%%X2_Y18%%X2_Y19%%X2_Y20%%X2_Y21%%X2_Y22%%X2_Y23%%X2_Y24%%X2_Y25%%X2_Y26%%X2_Y27%%X2_Y28%%X2_Y29%%X2_Y30%%X2_Y31%%X2_Y32%%X2_Y33%%X2_Y34%%X2_Y35%%X2_Y36%%X2_Y37%%X2_Y38%%X2_Y39%
set LINE_2= %X1_Y1%%X1_Y2%%X1_Y3%%X1_Y4%%X1_Y5%%X1_Y6%%X1_Y7%%X1_Y8%%X1_Y9%%X1_Y10%%X1_Y11%%X1_Y12%%X1_Y13%%X1_Y14%%X1_Y15%%X1_Y16%%X1_Y17%%X1_Y18%%X1_Y19%%X1_Y20%%X1_Y21%%X1_Y22%%X1_Y23%%X1_Y24%%X1_Y25%%X1_Y26%%X1_Y27%%X1_Y28%%X1_Y29%%X1_Y30%%X1_Y31%%X1_Y32%%X1_Y33%%X1_Y34%%X1_Y35%%X1_Y36%%X1_Y37%%X1_Y38%%X1_Y39%
set LINE_1= [ LIFES: %NB_LIFE% ] - [ SCORE: %SCORE% ]
cls
for /l %%A in (21,-1,1) do echo.!Line_%%A!
:: ################
:: PAUSE
:: ################
call :USE_KEY
goto :MOVE_PAC
:: #################################################################################
:: #
:: #
:: ######################## --- Définition des Mouvements --- ########################
:MOVE_PAC
for /f "delims=ULRDS" %%A in ("%TOUCH%") do (
goto :END_MOVE
)
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_PAC%") do (
set ExX=%%X
set ExY=%%Y
)
if %TOUCH%==S goto :RESET
if %TOUCH%==U set /a NwX=ExX+1
if %TOUCH%==U (
set NEW_POS_PAC=X%NwX%_Y%ExY%
goto :VERIF
)
if %TOUCH%==L set /a NwY=ExY-1
if %TOUCH%==L (
set NEW_POS_PAC=X%ExX%_Y%NwY%
goto :VERIF
)
if %TOUCH%==R set /a NwY=ExY+1
if %TOUCH%==R (
set NEW_POS_PAC=X%ExX%_Y%NwY%
goto :VERIF
)
if %TOUCH%==D set /a NwX=ExX-1
if %TOUCH%==D (
set NEW_POS_PAC=X%NwX%_Y%ExY%
goto :VERIF
)
:VERIF
if %NEW_POS_PAC%==X9_Y0 set NEW_POS_PAC=X9_Y39
if %NEW_POS_PAC%==X9_Y40 set NEW_POS_PAC=X9_Y1
for /f "tokens=*" %%A in ("%NEW_POS_PAC%") do (
set CORR=%%A
)
if !%CORR%! EQU %CVR% goto :END_MOVE
if !%CORR%! EQU %GUM% (
set /a NB_GUM=NB_GUM+1
set /a SCORE=SCORE+1
)
if !%CORR%! EQU %LIFE% set /a NB_LIFE=NB_LIFE+1
if !%CORR%! EQU %GHOST% goto :LOSE
set "%EX_POS_PAC%= "
for /f "tokens=*" %%A in ("%EX_POS_PAC%") do (
set "TRANS_%%A= "
)
set EX_POS_PAC=%NEW_POS_PAC%
set %NEW_POS_PAC%=%PAC%
if %NB_GUM% EQU %MAX_GUM% goto :END_LEVEL
:END_MOVE
goto :WALL
:: ############################################################################
:: #
:: #
:: ######################## ---LOSE--- ########################
:LOSE
set /a NB_LIFE=NB_LIFE-1
if %NB_LIFE%==0 goto :GAME_OVER
:: \\ Nouvel Emplacement du PAC-MAN ------
set "%EX_POS_PAC%= "
set NEW_POS_PAC=X9_Y20
set EX_POS_PAC=%NEW_POS_PAC%
set %NEW_POS_PAC%=%PAC%
cls
echo. &echo. &echo. &echo. &echo. &echo.
echo __ __ ___ _ _ _ ___ ____ _____
echo \ \ / / / _ \ ^| ^| ^| ^| ^| ^| / _ \ / ___^| ^|_ _^|
echo \ V / ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| ^| \___ \ ^| ^|
echo ^| ^| ^| ^|_^| ^| ^| ^|_^| ^| ^| ^|___ ^| ^|_^| ^| ___) ^| ^| ^|
echo ^|_^| \___/ \___/ ^|_____^| \___/ ^|____/ ^|_^|
echo.
echo ___ _ _ _____ _ ___ _____ _____
echo / _ \ ^| \ ^| ^| ^| ____^| ^| ^| ^|_ _^| ^| ___^| ^| ____^|
echo ^| ^| ^| ^| ^| \^| ^| ^| _^| ^| ^| ^| ^| ^| ^|_ ^| _^|
echo ^| ^|_^| ^| ^| ^|\ ^| ^| ^|___ ^| ^|___ ^| ^| ^| _^| ^| ^|___
echo \___/ ^|_^| \_^| ^|_____^| ^|_____^| ^|___^| ^|_^| ^|_____^|
echo.
echo -- Still %NB_LIFE% Lifes --
echo. &echo. &echo.
echo Press any key to continue the game ...
pause>nul
pause>nul
goto :WALL
:: ##############################################################
:: #
:: #
:: ######################## ---GAME-OVER--- ########################
:GAME_OVER
cls
echo. &echo. &echo. &echo. &echo. &echo. &echo. &echo.
echo ____ _ __ __ _____ ___ __ __ _____ ____
echo / ___^| / \ ^| \/ ^| ^| ____^| / _ \ \ \ / / ^| ____^| ^| _ \
echo ^| ^| _ / _ \ ^| ^|\/^| ^| ^| _^| ^| ^| ^| ^| \ \ / / ^| _^| ^| ^|_) ^|
echo ^| ^|_^| ^| / ___ \ ^| ^| ^| ^| ^| ^|___ ^| ^|_^| ^| \ V / ^| ^|___ ^| _ ^<
echo \____^| /_/ \_\ ^|_^| ^|_^| ^|_____^| \___/ \_/ ^|_____^| ^|_^| \_\
echo.
echo -- You are a LOSER --
echo. &echo. &echo. &echo. &echo. &echo. &echo.
echo Press any key to restart the game ...
pause>nul
pause>nul
goto :RESET
:: ##############################################################
:: #
:: #
:: ######################## ---END-LEVEL--- ########################
:END_LEVEL
cls
for /f "tokens=* delims=:LEVEL_" %%A in ("%LVL%") do (
set /a NEXT=%%A+1
)
set LVL=:LEVEL_%NEXT%
echo. &echo. &echo. &echo. &echo.
echo _ _____ __ __ _____ _
echo ^| ^| ^| ____^| \ \ / / ^| ____^| ^| ^|
echo ^| ^| ^| _^| \ \ / / ^| _^| ^| ^|
echo ^| ^|___ ^| ^|___ \ V / ^| ^|___ ^| ^|___
echo ^|_____^| ^|_____^| \_/ ^|_____^| ^|_____^|
echo ____ ___ __ __ ____ _ _____ _____ _____ ____
echo / ___^| / _ \ ^| \/ ^| ^| _ \ ^| ^| ^| ____^| ^|_ _^| ^| ____^| ^| _ \
echo ^| ^| ^| ^| ^| ^| ^| ^|\/^| ^| ^| ^|_) ^| ^| ^| ^| _^| ^| ^| ^| _^| ^| ^| ^| ^|
echo ^| ^|___ ^| ^|_^| ^| ^| ^| ^| ^| ^| __/ ^| ^|___ ^| ^|___ ^| ^| ^| ^|___ ^| ^|_^| ^|
echo \____^| \___/ ^|_^| ^|_^| ^|_^| ^|_____^| ^|_____^| ^|_^| ^|_____^| ^|____/
echo.
echo -- CONGRATULATION --
echo. &echo. &echo. &echo. &echo.
echo Press any key to continue the game ...
pause>nul
pause>nul
if %NEXT% GTR %LVL_MAX% goto :LAST_LEVEL
goto :LEVEL_%NEXT%
:: ###################################################################
:: #
:: #
:: ######################## ---LAST-LEVEL--- ########################
:LAST_LEVEL
cls
echo. &echo. &echo. &echo. &echo. &echo.
echo -- LAST LEVEL COMPLETED --
echo.
echo __ __ ___ _ _ __ __ ___ _ _
echo \ \ / / / _ \ ^| ^| ^| ^| \ \ / / ^|_ _^| ^| \ ^| ^|
echo \ V / ^| ^| ^| ^| ^| ^| ^| ^| \ \ /\ / / ^| ^| ^| \^| ^|
echo ^| ^| ^| ^|_^| ^| ^| ^|_^| ^| \ V V / ^| ^| ^| ^|\ ^|
echo ^|_^| \___/ \___/ \_/\_/ ^|___^| ^|_^| \_^|
echo.
echo [ SCORE: %SCORE% ]
echo. &echo. &echo. &echo. &echo. &echo. &echo. &echo.
echo Press any key to restart the game ...
pause>nul
pause>nul
goto :RESET
:: ###################################################################
:: #
:: #
:: ######################## --- Table ERRORLEVEL de KEY --- ########################
:USE_KEY
key
call :MOVE_GHOSTS
if %errorlevel%==72 set TOUCH=U
if %errorlevel%==75 set TOUCH=L
if %errorlevel%==77 set TOUCH=R
if %errorlevel%==80 set TOUCH=D
if %errorlevel%==32 set TOUCH=S
goto :EOF
:: ###################################################################
:: #
:: #
:: ######################## ---Déplacement de Fantômes--- ########################
:MOVE_GHOSTS
:: \\ Déplacement Ghost_1 ------------------
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G1%") do (
set Ex_X_G1=%%X
set Ex_Y_G1=%%Y
)
set /a DIRECT_X_G1 = Ex_X_G1 %OP_G1% 1
set /a DIRECT_Y_G1 = Ex_Y_G1 %OP_G1% 1
:RE-GHOSTS_G1
set NEW_POS_G1=X%DIRECT_X_G1%_Y%Ex_Y_G1%
for /f "tokens=*" %%A in ("%NEW_POS_G1%") do (
set CORR_G1=%%A
)
if !%CORR_G1%!==%CVR% goto :JUMP_G1A
if !%CORR_G1%!==%PAC% goto :LOSE
if %NEW_POS_G1%==X9_Y0 set NEW_POS_G1=X9_Y39
if %NEW_POS_G1%==X9_Y40 set NEW_POS_G1=X9_Y1
set "%EX_POS_G1%=!TRANS_%EX_POS_G1%!"
set "EX_POS_G1=%NEW_POS_G1%"
set "%NEW_POS_G1%=%GHOST%"
goto :END_MOVE_GHOSTS_G1
:JUMP_G1A
set NEW_POS_G1=X%Ex_X_G1%_Y%DIRECT_Y_G1%
for /f "tokens=*" %%A in ("%NEW_POS_G1%") do (
set CORR_G1=%%A
)
if !%CORR_G1%!==%CVR% goto :JUMP_G1B
if !%CORR_G1%!==%PAC% goto :LOSE
if %NEW_POS_G1%==X9_Y0 set NEW_POS_G1=X9_Y39
if %NEW_POS_G1%==X9_Y40 set NEW_POS_G1=X9_Y1
set "%EX_POS_G1%=!TRANS_%EX_POS_G1%!"
set "EX_POS_G1=%NEW_POS_G1%"
set "%NEW_POS_G1%=%GHOST%"
goto :END_MOVE_GHOSTS_G1
:JUMP_G1B
if %OP_G1%==+ (
set "OP_G1=-"
) else (
set "OP_G1=+"
)
set /a DIRECT_X_G1 = Ex_X_G1 %OP_G1% 1
set /a DIRECT_Y_G1 = Ex_Y_G1 %OP_G1% 1
goto :RE-GHOSTS_G1
:END_MOVE_GHOSTS_G1
:: ########## end ghost 1 ---
:: \\ Déplacement Ghost_2
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G2%") do (
set Ex_X_G2=%%X
set Ex_Y_G2=%%Y
)
set /a DIRECT_X_G2 = Ex_X_G2 %OP_G2% 1
set /a DIRECT_Y_G2 = Ex_Y_G2 %OP_G2% 1
:RE-GHOSTS_G2
set NEW_POS_G2=X%DIRECT_X_G2%_Y%Ex_Y_G2%
for /f "tokens=*" %%A in ("%NEW_POS_G2%") do (
set CORR_G2=%%A
)
if !%CORR_G2%!==%CVR% goto :JUMP_G2A
if !%CORR_G2%!==%PAC% goto :LOSE
if %NEW_POS_G2%==X9_Y0 set NEW_POS_G2=X9_Y39
if %NEW_POS_G2%==X9_Y40 set NEW_POS_G2=X9_Y1
set "%EX_POS_G2%=!TRANS_%EX_POS_G2%!"
set "EX_POS_G2=%NEW_POS_G2%"
set "%NEW_POS_G2%=%GHOST%"
goto :END_MOVE_GHOSTS_G2
:JUMP_G2A
set NEW_POS_G2=X%Ex_X_G2%_Y%DIRECT_Y_G2%
for /f "tokens=*" %%A in ("%NEW_POS_G2%") do (
set CORR_G2=%%A
)
if !%CORR_G2%!==%CVR% goto :JUMP_G2B
if !%CORR_G2%!==%PAC% goto :LOSE
if %NEW_POS_G2%==X9_Y0 set NEW_POS_G2=X9_Y39
if %NEW_POS_G2%==X9_Y40 set NEW_POS_G2=X9_Y1
set "%EX_POS_G2%=!TRANS_%EX_POS_G2%!"
set "EX_POS_G2=%NEW_POS_G2%"
set "%NEW_POS_G2%=%GHOST%"
goto :END_MOVE_GHOSTS_G2
:JUMP_G2B
if %OP_G2%==+ (
set "OP_G2=-"
) else (
set "OP_G2=+"
)
set /a DIRECT_X_G2 = Ex_X_G2 %OP_G2% 1
set /a DIRECT_Y_G2 = Ex_Y_G2 %OP_G2% 1
goto :RE-GHOSTS_G2
:END_MOVE_GHOSTS_G2
:: ########## end ghost 2 ---
:: \\ Déplacement Ghost_3
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G3%") do (
set Ex_X_G3=%%X
set Ex_Y_G3=%%Y
)
set /a DIRECT_X_G3 = Ex_X_G3 %OP_G3% 1
set /a DIRECT_Y_G3 = Ex_Y_G3 %OP_G3% 1
:RE-GHOSTS_G3
set NEW_POS_G3=X%Ex_X_G3%_Y%DIRECT_Y_G3%
for /f "tokens=*" %%A in ("%NEW_POS_G3%") do (
set CORR_G3=%%A
)
if !%CORR_G3%!==%CVR% goto :JUMP_G3A
if !%CORR_G3%!==%PAC% goto :LOSE
if %NEW_POS_G3%==X9_Y0 set NEW_POS_G3=X9_Y39
if %NEW_POS_G3%==X9_Y40 set NEW_POS_G3=X9_Y1
set "%EX_POS_G3%=!TRANS_%EX_POS_G3%!"
set "EX_POS_G3=%NEW_POS_G3%"
set "%NEW_POS_G3%=%GHOST%"
goto :END_MOVE_GHOSTS_G3
:JUMP_G3A
set NEW_POS_G3=X%DIRECT_X_G3%_Y%Ex_Y_G3%
for /f "tokens=*" %%A in ("%NEW_POS_G3%") do (
set CORR_G3=%%A
)
if !%CORR_G3%!==%CVR% goto :JUMP_G3B
if !%CORR_G3%!==%PAC% goto :LOSE
if %NEW_POS_G3%==X9_Y0 set NEW_POS_G3=X9_Y39
if %NEW_POS_G3%==X9_Y40 set NEW_POS_G3=X9_Y1
set "%EX_POS_G3%=!TRANS_%EX_POS_G3%!"
set "EX_POS_G3=%NEW_POS_G3%"
set "%NEW_POS_G3%=%GHOST%"
goto :END_MOVE_GHOSTS_G3
:JUMP_G3B
if %OP_G3%==+ (
set "OP_G3=-"
) else (
set "OP_G3=+"
)
set /a DIRECT_X_G3 = Ex_X_G3 %OP_G3% 1
set /a DIRECT_Y_G3 = Ex_Y_G3 %OP_G3% 1
goto :RE-GHOSTS_G3
:END_MOVE_GHOSTS_G3
:: ########## end ghost 3 ---
:: \\ Déplacement Ghost_4
for /f "tokens=1,2 delims=X,Y,_" %%X in ("%EX_POS_G4%") do (
set Ex_X_G4=%%X
set Ex_Y_G4=%%Y
)
set /a DIRECT_X_G4 = Ex_X_G4 %OP_G4% 1
set /a DIRECT_Y_G4 = Ex_Y_G4 %OP_G4% 1
:RE-GHOSTS_G4
set NEW_POS_G4=X%DIRECT_X_G4%_Y%Ex_Y_G4%
for /f "tokens=*" %%A in ("%NEW_POS_G4%") do (
set CORR_G4=%%A
)
if !%CORR_G4%!==%CVR% goto :JUMP_G4A
if !%CORR_G4%!==%PAC% goto :LOSE
if %NEW_POS_G4%==X9_Y0 set NEW_POS_G4=X9_Y39
if %NEW_POS_G4%==X9_Y40 set NEW_POS_G4=X9_Y1
set "%EX_POS_G4%=!TRANS_%EX_POS_G4%!"
set "EX_POS_G4=%NEW_POS_G4%"
set "%NEW_POS_G4%=%GHOST%"
goto :END_MOVE_GHOSTS_G4
:JUMP_G4A
set NEW_POS_G4=X%Ex_X_G4%_Y%DIRECT_Y_G4%
for /f "tokens=*" %%A in ("%NEW_POS_G4%") do (
set CORR_G4=%%A
)
if !%CORR_G4%!==%CVR% goto :JUMP_G4B
if !%CORR_G4%!==%PAC% goto :LOSE
if %NEW_POS_G4%==X9_Y0 set NEW_POS_G4=X9_Y39
if %NEW_POS_G4%==X9_Y40 set NEW_POS_G4=X9_Y1
set "%EX_POS_G4%=!TRANS_%EX_POS_G4%!"
set "EX_POS_G4=%NEW_POS_G4%"
set "%NEW_POS_G4%=%GHOST%"
goto :END_MOVE_GHOSTS_G4
:JUMP_G4B
if %OP_G4%==+ (
set "OP_G4=-"
) else (
set "OP_G4=+"
)
set /a DIRECT_X_G4 = Ex_X_G4 %OP_G4% 1
set /a DIRECT_Y_G4 = Ex_Y_G4 %OP_G4% 1
goto :RE-GHOSTS_G4
:END_MOVE_GHOSTS_G4
:: ########## end ghost 4 ---
goto :EOF
:: ###################################################################
:: ------------------------------ CODE --------------------