Friday, December 9, 2011

Creating Games using Batch file | Part - 3

So here comes games.. Help yourself.

Instructions:
> Copy the below scripts to notepad
> Save it as .bat
> Convert .bat to .exe using this software




Tetris v 1.3  tetrissplash.png
  

@Echo off
@title Tetris v1.3
@mode con cols=28 lines=24
Setlocal enabledelayedexpansion enableextensions

:: Batch Game - Tetris v1.3
:: Coded by SmartGenius
:: SmartGenius, Corp. 2010
:: Greets to Carlos ;) (for KBD and bug fixes)

Set "Game=%0"

Kbd.exe 1 2>Nul
If "%Errorlevel%"=="9009" (Echo. Kbd command not found&Pause&Exit /b)

Call :Logo

:Menu
Cls
Echo.
Echo.
Echo. Tetris v1.3 by SmartGenius
Echo. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Echo. ÚÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄ¿
Echo. ³1.³ ³Play TETRIS ³
Echo. ÀÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ
Echo. ÚÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄ¿
Echo. ³2.³ ³How to Play ³
Echo. ÀÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ
Echo. ÚÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄ¿
Echo. ³3.³ ³Exit Game   ³
Echo. ÀÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ
Echo.
:MenuIn
Kbd.exe 2
If "%errorlevel%"=="49" (Goto :Load)
If "%errorlevel%"=="50" (Goto :Help)
If "%errorlevel%"=="51" (Goto :End)
Goto :MenuIn

:Load
Set /a "LimX=18","LimY=16","TBound=1","LBound=0","Turn=1","Points=0"
Set /a "RBound=%LimX%","BBound=%LimY%"

:Init
For /l %%a in (0,1,%LimX%) do (
For /l %%b in (0,1,%LimY%) do (
Set "X%%aY%%b= "))
Set "Bound=Û"
Set "Bound2=²"
Set /a "NoPress=0,Pressed=0,Over=0"

:Main
Set /a "L=(%Random% %% 7)+1"
Call :Figure%L%
Call :Graphic
If !Over! Equ 1 Goto :Menu
Goto :Main

:Graphic
Call :Clear
Call :CheckL2
If "%New_F%"=="True" (
Call :Solid
Set "New_F=False"
Goto :Eof
)
Call :Clear
Cls
Echo.
Echo. Tetris v1.3 by SmartGenius
Echo.
Echo.   Points:%Points%
Echo.   ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
For /l %%f in (0,1,%LimY%) do (Echo.   º!Lin_%%f!º)
Echo.   ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
:Move
Kbd.exe 1
Set /a "K=!ErrorLevel!"
If !k! Equ 0 (
  Set /a "NoPress+=1"
  If !NoPress! Equ 3 (
    Set /a "NoPress=0"
    Call :Down
  )
) Else Set /a "Pressed+=1"
If !k! Equ 80 (Call :Down)
If !k! Equ 75 (Call :Left)
If !k! Equ 77 (Call :Rigth)
If !k! Equ 32 (Call :Rotate)
If !k! Equ 120 (Set /a "Over=1" & Goto :Eof)
If !k! Equ 88 (Set /a "Over=1" & Goto :Eof)
If !k! Equ 99 (Call :MovCR)
If !k! Equ 67 (Call :MovCR)
If !Pressed! Equ 3 (
  Set /a "Pressed=0"
  Call :Down
)
If !Over! Equ 1 Goto :Lost
Goto :Graphic

::::::::::::::::::::::::::::::::::::::::
:Solid
For %%a in (%Table%) do (Set "%%a=%Bound2%")
Goto :Eof

:Rotate
Set "TmpTB="
If "%XToken%"=="-7" (Set "XToken=-6")
If "%XToken%"=="11" (Set "XToken=10")
If "%YToken%"=="15" (Set "XToken=14")
Set /a "NextRotate=(%RotateLevel% %% 4)+1"
Set "TmpTable=!Figure%CurFig%_Pos%NextRotate%!
For %%R in (%TmpTable%) do (
Call :MovR "%YToken%" "%XToken%" "%%R" "Val"
Call Set "TmpTB=!TmpTB!,!Val!"
)
For %%c in (%TmpTB:~1%) do (
If "!%%c!"=="%Bound2%" (
For %%b in (%Table%) do (Set "%%b=%Bound%")
Goto :Eof
))
For %%a in (%Table%) do (Set "%%a= ")
Set "Table=%TmpTB:~1%"
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "RotateLevel+=1"
Goto :Eof

:MovR
For /f "tokens=1,2 delims=X,Y" %%p in ("%~3") do (
Set /a MovY=%%q+%~1
Set /a MovX=%%p+%~2
Set "%~4=X!MovX!Y!MovY!"
Set "%~3= ")
Goto :Eof

:::::::::::::::::::::::::::::::::::::::::::
:Down
Set "TmpTB="
Set "TmpTable=%Table%"
For %%a in (%TmpTable%) do (
Echo.!TmpTable!|Find "Y%BBound%">nul
If !Errorlevel! EQU 0 (Set "New_F=True"&Goto :Eof)
Call :MovYR "1" "%%a" "Val"
Call Set "TmpTB=!TmpTB!,!Val!"
)
For %%c in (%TmpTB:~1%) do (
If "!%%c!"=="%Bound2%" (
Set "New_F=True"
For %%b in (%Table%) do (Set "%%b=%Bound%")
Goto :Eof
))
Set "Table=%TmpTB:~1%"
For %%d in (%Table%) do (Set "%%d=%Bound%")
Set /a "YToken+=1"
Goto :Eof

:MovYR
For /f "tokens=1,2 delims=X,Y" %%p in ("%~2") do (
Set /a MovY=%%q+%~1
Set "%~3=X%%pY!MovY!"
Set "%~2= ")
Goto :Eof

:MovCR
Cls
Echo.
Echo.
Call :L2 "Goto :Eof"
Echo.
For /f "tokens=2 skip=3" %%c in ('find "::_0" %Game%') do (
Set "Tmp_Var=%%c"
Call :Key.A Tmp_Var
Echo. !Tmp_Var!
)
Pause >nul
Goto :Eof
::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::
:Rigth
Set "TmpTB="
Set "TmpTable=%Table%"
For %%a in (%TmpTable%) do (
Echo.!TmpTable!|Find "X%RBound%">nul
If !Errorlevel! EQU 0 (Goto :Eof)
Call :MovXR "+1" "%%a" "Val"
Call Set "TmpTB=!TmpTB!,!Val!"
)
For %%c in (%TmpTB:~1%) do (
If "!%%c!"=="%Bound2%" (
For %%b in (%Table%) do (Set "%%b=%Bound%")
Goto :Eof
))
Set "Table=%TmpTB:~1%"
For %%d in (%Table%) do (Set "%%d=%Bound%")
Set /a "XToken+=1"
Goto :Eof

:Left
Set "TmpTB="
Set "TmpTable=%Table%"
For %%a in (%TmpTable%) do (
Echo.!TmpTable!|Find "X%LBound%">nul
If !Errorlevel! EQU 0 (Goto :Eof)
Call :MovXR "-1" "%%a" "Val"
Call Set "TmpTB=!TmpTB!,!Val!"
)
For %%c in (%TmpTB:~1%) do (
If "!%%c!"=="%Bound2%" (
For %%b in (%Table%) do (Set "%%b=%Bound%")
Goto :Eof
))
Set "Table=%TmpTB:~1%"
For %%d in (%Table%) do (Set "%%d=%Bound%")
Set /a "XToken-=1"
Goto :Eof

:MovXR
For /f "tokens=1,2 delims=X,Y" %%p in ("%~2") do (
Set /a MovX=%%p%~1
Set "%~3=X!MovX!Y%%q"
Set "%~2= ")
Goto :Eof

::::::::::::::::::::::::::::::::::::::::
:CheckL2
Echo.%Lin_1%|Find "%Bound2%">nul
If !Errorlevel! EQU 0 (Goto :Lost)

Echo.!Lin_%LimY%!|Find " ">nul
If !Errorlevel! EQU 0 (Goto :Eof)

Call :Solid

For /l %%x in (0,1,%LimX%) do (
For /l %%y in (%LimY%,-1,1) do (
Set /a "UpLine=%%y-1"
Call Set "X%%xY%%y=%%X%%xY!UpLine!%%"
))
Set /a "Points+=100"
For /l %%d in (0,1,%LimX%) do (Set "X%%dY0= ")
Call :Clear
Goto :CheckL2
:::::::::::::::::::::::::::::::::::::::::

:Key.A
If not defined %1 Goto:Eof
Set "c="
Set "d=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz =/\()[]{}_-.:,;* @#"
:Key.B
Set "chr=!%1:~,1!"
For /l %%l in (0 1 80) do if "!chr!" equ "!d:~%%l,1!" (
  set /a "x=%%l^5"
  call set "c=!c!%%d:~!x!,1%%"
)
Set "%1=!%1:~1!"
If defined %1 goto:Key.B
Set "%1=!c!"
Goto :Eof
:::::::::::::::::::::::::::::::::::::::::

:Clear
For /l %%m in (0,1,%LimY%) do (Set Lin_%%m=)
For /l %%d in (0,1,%LimY%) do (
For /l %%e in (0,1,%LimX%) do (
Set Lin_%%d=!Lin_%%d!!X%%eY%%d!))
Goto :Eof

:Lost
Cls
Echo.
Echo. Tetris v 1.3 by SmartGenius
Echo.
Echo.     Points:%Points%
Echo.        Perdiste !
Goto :End

:Win
Cls
Echo.
Echo. Tetris v 1.3 by SmartGenius
Echo.
Echo.     Points:%Points%
Echo.      Has Ganado !
Goto :End

:End
Echo.     Thanks for Play
Echo. Tetris v1.2 by SmartGenius
Endlocal
Ping -n 3 localhost >nul
Goto :Menu

::::::::::::::::::::::::::::::::::::::::::
:Figure1
Set Figure1_Pos1=X6Y2,X6Y1,X7Y1,X7Y0
Set Figure1_Pos2=X7Y1,X8Y1,X6Y0,X7Y0
Set Figure1_Pos3=X6Y2,X6Y1,X7Y1,X7Y0
Set Figure1_Pos4=X7Y1,X8Y1,X6Y0,X7Y0
Set /a "R=(%Random% %% 4)+1"
Set Table=!Figure1_Pos%R%!
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=1","RotateLevel=%R%"
Goto :Eof

:Figure2
Set Figure2_Pos1=X7Y2,X6Y1,X7Y1,X6Y0
Set Figure2_Pos2=X6Y1,X7Y1,X7Y0,X8Y0
Set Figure2_Pos3=X7Y2,X6Y1,X7Y1,X6Y0
Set Figure2_Pos4=X6Y1,X7Y1,X7Y0,X8Y0
Set /a "R=(%Random% %% 4)+1"
Set Table=!Figure2_Pos%R%!
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=2","RotateLevel=%R%"
Goto :Eof

:Figure3
Set Figure3_Pos1=X7Y1,X8Y1,X7Y0,X8Y0
Set Figure3_Pos2=X7Y1,X8Y1,X7Y0,X8Y0
Set Figure3_Pos3=X7Y1,X8Y1,X7Y0,X8Y0
Set Figure3_Pos4=X7Y1,X8Y1,X7Y0,X8Y0
Set /a "R=(%Random% %% 4)+1"
Set "Table=!Figure3_Pos%R%!"
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=3","RotateLevel=%R%"
Goto :Eof

:Figure4
Set Figure4_Pos1=X6Y1,X7Y1,X8Y1
Set Figure4_Pos2=X7Y2,X7Y1,X7Y0
Set Figure4_Pos3=X6Y1,X7Y1,X8Y1
Set Figure4_Pos4=X7Y2,X7Y1,X7Y0
Set /a "R=(%Random% %% 4)+1"
Set Table=!Figure4_Pos%R%!
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=4","RotateLevel=%R%"
Goto :Eof

:Figure5
Set Figure5_Pos1=X6Y1,X7Y1,X8Y1,X7Y0
Set Figure5_Pos2=X7Y2,X7Y1,X8Y1,X7Y0
Set Figure5_Pos3=X7Y1,X6Y0,X7Y0,X8Y0
Set Figure5_Pos4=X8Y2,X7Y1,X8Y1,X8Y0
Set /a "R=(%Random% %% 4)+1"
Set Table=!Figure5_Pos%R%!
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=5","RotateLevel=%R%"
Goto :Eof

:Figure6
Set Figure6_Pos1=X6Y0,X7Y0,X8Y0,X6Y1
Set Figure6_Pos2=X7Y0,X8Y2,X8Y1,X8Y0
Set Figure6_Pos3=X6Y1,X7Y1,X8Y1,X8Y0
Set Figure6_Pos4=X6Y2,X7Y2,X6Y1,X6Y0
Set /a "R=(%Random% %% 4)+1"
Set Table=!Figure6_Pos%R%!
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=6","RotateLevel=%R%"
title Fig:6 Pos:%R%
Goto :Eof

:Figure7
Set Figure7_Pos1=X8Y1,X6Y0,X7Y0,X8Y0
Set Figure7_Pos2=X7Y2,X8Y2,X8Y1,X8Y0
Set Figure7_Pos3=X6Y1,X7Y1,X8Y1,X6Y0
Set Figure7_Pos4=X6Y2,X6Y1,X6Y0,X7Y0
Set /a "R=(%Random% %% 4)+1"
Set Table=!Figure7_Pos%R%!
For %%b in (%Table%) do (Set "%%b=%Bound%")
Set /a "XToken=0","YToken=0","CurFig=7","RotateLevel=%R%"
Goto :Eof

::_0 xx9tYjYxWvxPrXmoLjqfzpxxx
::_0 xxxxxXhXxLBINRPFGBaxxxxxx
::_0 xxxxxxxxxxxxxxxxxxxxxxxxx
::_0 xxxxx8jYfZXojYxOtxJvxxxxx
::_0 EjXzofizgxLfmgimfjqYx9GVJ
::_0 xxxJvx8XmgfqlxNxGtyjxRxxx
::_0 xxxxxxxxxxxxxxxxxxxxxxxxx
::_0 xxxLmjjopxotx9Xmgtpxxxxxx
::_0 xPrXmoLjqfzpx9tms-x7545xx

:Help
Cls
Echo.
Call :L2 "Goto :Eof"
Echo.
Echo. How to Play Batch Tetris ?
Echo.
Echo. Use arrow keys, space and X
Echo.
Echo. Left = Move Shape Left
Echo. Down = Move Shape Down
Echo. Right = Move Shape Rigth
Echo. Space = Rotate Shape
Echo. X = Back to Menu Game
Echo.
Echo. 
Pause >nul
Goto :Menu

:Logo
Cls
Color 0b
Echo.
Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
:L2
Echo. °°ÛÛÛ°ÛÛÛ°ÛÛÛ°ÛÛ°°Û°°ÛÛ°°°
Echo. °°°Û°°Û°°°°Û°°Û°Û°Û°Û°°°°°
Echo. °°°Û°°ÛÛÛ°°Û°°ÛÛ°°Û°°Û°°°°
Echo. °°°Û°°Û°°°°Û°°Û°Û°Û°°°Û°°°
Echo. °°°Û°°ÛÛÛ°°Û°°Û°Û°Û°ÛÛ°°°°
%~1
Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
Echo. °°±°°°°°°°°°²°°°°°°°°°°±°°
Echo. °°±°²°°°²²°°²²°°°²²²°°°±°°
Echo. °°±°²²°°°²°°²°°°°°°°°°°±°°
Echo. °°±°°²°°°²°°°°°°²²°°°°°±°°
Echo. °°±°°°°°°°°°°°°°°²²°°°°±°°
Echo. °°±°°°°°°°°²°°°°°°°°°°°±°°
Echo. °°±²°°°°°°°²²²°°°°°°°°°±°°
Echo. °°±²°°²²°°°°°°°²°°°°°°²±°°
Echo. °°±²°°²²°°°°°°²²²°°°²²²±°°
Echo. °°±±±±±±±±±±±±±±±±±±±±±±°°
Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
Echo. °°°°°: SmartGenius :°°°°°°
Echo. °°°°°  Corp.  2010  °°°°°°
Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
Ping -n 3 0.0.0.0 >nul
Goto :Eof
 Tetris Batch Game updated, uses KBD instead of CHOICE, fixed some bugs, shapes falls by default. Re-download and try the new version of the game v 1.3
Download

===============================================================================

Pacman v 1
pacmanv1dg5.png



Code:
 @echo off
@title PacMan v 1
 @mode con cols=24 lines=24
 @::Juego Batch PacMan
 @::Another Batch Game
 @::by ::SmartGenius ::

if not exist "choice.com" (Goto :NoKey)

:load
call :Logo
setlocal enabledelayedexpansion
set LimX=16
set LimY=16
set NLevels=1

:init
for /l %%a in (0,1,%LimX%) do (
for /l %%b in (0,1,%LimY%) do (
set X%%aY%%b=.))
set Player=
set Bound=Û
set Box= 
set Ghost=

:Levels
set /a L+=1
Call :Level%L%
Call :Graphic
set P%L%=%Movs%
if "%NXL%"=="True" Goto :End
if "%L%"=="%NLevels%" Goto :Win
ping -n 1 0.0.0.0 >nul
Goto :Init

:Graphic
Call :Clear
cls
for /l %%d in (0,1,%LimY%) do (
for /l %%e in (0,1,%LimX%) do (
set Lin_%%d=!Lin_%%d!!X%%eY%%d!))
echo.
echo.  Pacman v 1 by Smart
echo.
echo.  Lives:%Lives%   Points:%Points%
echo.   ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
for /l %%f in (0,1,%LimY%) do (echo.   º!Lin_%%f!º)
echo.   ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
CHOICE /C:WASDX /N /T:%Dir%,1 >nul
if "%errorlevel%"=="1" (call :MovY- "%CurPos%" CurPos&set Dir=W)
if "%errorlevel%"=="2" (call :MovX- "%CurPos%" CurPos&set Dir=A)
if "%errorlevel%"=="3" (call :MovY+ "%CurPos%" CurPos&set Dir=S)
if "%errorlevel%"=="4" (call :MovX+ "%CurPos%" CurPos&set Dir=D)
if "%errorlevel%"=="5" (set NXL=True&Goto :Eof)
Call :MovGhost
for %%w in (%Boxes%) do (
if not "!%%w!"=="%Box%" (
if "!%%w!"=="." (set %%w=%Box%)))
set /a NCK=%Points% %% 7
if "%NCK%"=="0" set Cki=False
if "%EOG%"=="True" (msg * You Lost&Goto :Eof)
Goto :Graphic

:MovX+
for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
set /a MovX=%%p+1
call set NMovX=%%X!MovX!Y%%q%%

if "!NMovX!"=="%Bound%" (Goto :Eof)

if "!NMovX!"=="%Ghost%" (
if !%~1!==%Player% (
if "%Cki%"=="True" (
set %~1= 
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q
set /a Points+=10
call :UnGhost "X!MovX!Y%%q"
)
if "%Cki%"=="False" (
set %~1= 
set /a Lives-=1
set %Init%=%Player%
set %2=%Init%
if "!Lives!"=="0" (set EOG=True)
)))

if "!NMovX!"=="." (
if !%~1!==%Player% (
set %~1= 
set /a Points+=2
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q)
if !%~1!==%Ghost% (
set %~1=.
set X!MovX!Y%%q=%Ghost%
set %2=X!MovX!Y%%q))

if "!NMovX!"==" " (
if !%~1!==%Player% (
set %~1= 
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q)
if !%~1!==%Ghost% (
set %~1= 
set X!MovX!Y%%q=%Ghost%
set %2=X!MovX!Y%%q))


if "!NMovX!"=="%Box%" (
if !%~1!==%Player% (
set %~1= 
set /a Points+=5
set Cki=True
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q)
if !%~1!==%Ghost% (
set %~1=.
set X!MovX!Y%%q=%Ghost%
set %2=X!MovX!Y%%q)))

if !%~1!==%Player% set /a Movs+=1
Goto :Eof


:MovX-
for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
set /a MovX=%%p-1
call set NMovX=%%X!MovX!Y%%q%%

if "!NMovX!"=="%Bound%" (Goto :Eof)

if "!NMovX!"=="%Ghost%" (
if !%~1!==%Player% (
if "%Cki%"=="True" (
set %~1= 
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q
set /a Points+=10
call :UnGhost "X!MovX!Y%%q"
)
if "%Cki%"=="False" (
set %~1= 
set /a Lives-=1
set %Init%=%Player%
set %2=%Init%
if "!Lives!"=="0" (set EOG=True)
)))

if "!NMovX!"=="." (
if !%~1!==%Player% (
set %~1= 
set /a Points+=2
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q)
if !%~1!==%Ghost% (
set %~1=.
set X!MovX!Y%%q=%Ghost%
set %2=X!MovX!Y%%q))

if "!NMovX!"==" " (
if !%~1!==%Player% (
set %~1= 
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q)
if !%~1!==%Ghost% (
set %~1= 
set X!MovX!Y%%q=%Ghost%
set %2=X!MovX!Y%%q))


if "!NMovX!"=="%Box%" (
if !%~1!==%Player% (
set %~1= 
set /a Points+=5
set Cki=True
set X!MovX!Y%%q=%Player%
set %2=X!MovX!Y%%q)
if !%~1!==%Ghost% (
set %~1=.
set X!MovX!Y%%q=%Ghost%
set %2=X!MovX!Y%%q)))

if !%~1!==%Player% set /a Movs+=1
Goto :Eof


:MovY+
for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
set /a MovY=%%q+1
call set NMovY=%%X%%pY!MovY!%%

if "!NMovY!"=="%Bound%" (Goto :Eof)

if "!NMovY!"=="%Ghost%" (
if !%~1!==%Player% (
if "%Cki%"=="True" (
set %~1= 
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!
set /a Points+=10
call :UnGhost "X%%pY!MovY!"
)
if "%Cki%"=="False" (
set %~1= 
set /a Lives-=1
set %Init%=%Player%
set %2=%Init%
if "!Lives!"=="0" (set EOG=True)
)))

if "!NMovY!"=="." (
if !%~1!==%Player% (
set %~1= 
set /a Points+=2
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!)
if !%~1!==%Ghost% (
set %~1=.
set X%%pY!MovY!=%Ghost%
set %2=X%%pY!MovY!))

if "!NMovY!"==" " (
if !%~1!==%Player% (
set %~1= 
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!)
if !%~1!==%Ghost% (
set %~1= 
set X%%pY!MovY!=%Ghost%
set %2=X%%pY!MovY!))


if "!NMovY!"=="%Box%" (
if !%~1!==%Player% (
set %~1= 
set /a Points+=5
set Cki=True
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!)
if !%~1!==%Ghost% (
set %~1=.
set X%%pY!MovY!=%Ghost%
set %2=X%%pY!MovY!)))

if !%~1!==%Player% set /a Movs+=1
Goto :Eof


:MovY-
for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
set /a MovY=%%q-1
call set NMovY=%%X%%pY!MovY!%%

if "!NMovY!"=="%Bound%" (Goto :Eof)

if "!NMovY!"=="%Ghost%" (
if !%~1!==%Player% (
if "%Cki%"=="True" (
set %~1= 
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!
set /a Points+=10
call :UnGhost "X%%pY!MovY!"
)
if "%Cki%"=="False" (
set %~1= 
set /a Lives-=1
set %Init%=%Player%
set %2=%Init%
if "!Lives!"=="0" (set EOG=True)
)))

if "!NMovY!"=="." (
if !%~1!==%Player% (
set %~1= 
set /a Points+=2
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!)
if !%~1!==%Ghost% (
set %~1=.
set X%%pY!MovY!=%Ghost%
set %2=X%%pY!MovY!))

if "!NMovY!"==" " (
if !%~1!==%Player% (
set %~1= 
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!)
if !%~1!==%Ghost% (
set %~1= 
set X%%pY!MovY!=%Ghost%
set %2=X%%pY!MovY!))


if "!NMovY!"=="%Box%" (
if !%~1!==%Player% (
set %~1= 
set /a Points+=5
set Cki=True
set X%%pY!MovY!=%Player%
set %2=X%%pY!MovY!)
if !%~1!==%Ghost% (
set %~1=.
set X%%pY!MovY!=%Ghost%
set %2=X%%pY!MovY!)))

if !%~1!==%Player% set /a Movs+=1
Goto :Eof


:MovGhost
set NGG=0
for %%z in (%Ghosts%) do (
set /a NG+=1
set Ghost!NG!=%%z)
:MovGhost2
set /a NGG+=1
set /a GoMov=%random:~-1% %% 4
if "!GoMov!"=="0" Call :MovX+ %%Ghost!NGG!%% Ghost!NGG!
if "!GoMov!"=="1" Call :MovX- %%Ghost!NGG!%% Ghost!NGG!
if "!GoMov!"=="2" Call :MovY+ %%Ghost!NGG!%% Ghost!NGG!
if "!GoMov!"=="3" Call :MovY- %%Ghost!NGG!%% Ghost!NGG!
)
if "%NGG%"=="4" ( 
set Ghosts=%Ghost1%,%Ghost2%,%Ghost3%,%Ghost4%
set NG=0
Goto :Eof)
Goto :MovGhost2

:UnGhost
set Ghosts=!Ghosts:%~1=X8Y7!
for %%g in (%Ghosts%) do (set %%g=%Ghost%)
Goto :Eof

:Clear
for /l %%m in (0,1,%LimY%) do (set Lin_%%m=)
Goto :Eof

:Win

:End
msg * Thx for Playing PacMan v1 by :: SmartGenius::
endlocal
exit

:Level1
set Movs=0
set Points=0
set X2Y15=%Player%
set CurPos=X2Y15
set Init=X2Y15
set Lives=3
set Cki=False
set Dir=D
set Ghosts=X2Y11,X6Y9,X6Y7,X10Y6
set Boxes=X2Y1,X2Y9,X14Y1,X14Y9,X14Y15
for %%g in (%Ghosts%) do (set %%g=%Ghost%)
for %%h in (%Boxes%) do (set %%h=%Box%)
for /l %%i in (0,1,16) do (
set X0Y%%i=%Bound%
set X1Y%%i=%Bound%
set X15Y%%i=%Bound%
set X16Y%%i=%Bound%
set X%%iY0=%Bound%
set X%%iY16=%Bound%)
for %%j in (3,4,5,6,10,11,12,13) do (
set X%%jY2=%Bound%
set X%%jY3=%Bound%
set X%%jY10=%Bound%
set X%%jY14=%Bound%)
for %%k in (X8Y1,X8Y2,X8Y3,X3Y5,X3Y6,X3Y7,X3Y8,X5Y5,X5Y6,X5Y7,X5Y8,X6Y5,X7Y5) do (set %%k=%Bound%)
for %%l in (X6Y8,X7Y8,X8Y8,X9Y8,X10Y8,X9Y5,X10Y5,X11Y5,X11Y6,X11Y7,X11Y8,X13Y5) do (set %%l=%Bound%)
for %%m in (X13Y6,X13Y7,X13Y8,X7Y10,X9Y10,X3Y12,X3Y13,X5Y12,X6Y12,X7Y12,X8Y12) do (set %%m=%Bound%)
for %%n in (X9Y12,X10Y12,X11Y12,X8Y13,X8Y14,X13Y12,X13Y13) do (set %%n=%Bound%)
for %%o in (X6Y6,X7Y6,X8Y5,X8Y6,X9Y6,X7Y7,X8Y7,X9Y7,X10Y7) do (set %%o= )
Goto :Eof

::Fin Nivel 1

::Fin de Coordenadas

:Logo
color 0a
cls
echo.
echo. °°°°°°°°°°°°°°°°°°°°°°
echo. °°°°°°°°°°°°°°°°°°°°°°
echo. °ÛÛÛÛÛ°ÛÛÛÛÛ°°ÛÛÛÛÛÛ°°
echo. °Û°°°Û°Û°°°Û°ÛÛÛÛÛÛ°°°
echo. °Û°°°Û°Û°°°Û°ÛÛÛÛ°°°°°
echo. °ÛÛÛÛÛ°ÛÛÛÛÛ°ÛÛÛ°°°°°°
echo. °Û°°°°°Û°°°Û°ÛÛÛÛ°°°°°
echo. °Û°°°°°Û°°°Û°ÛÛÛÛÛÛ°°°
echo. °Û°°°°°Û°°°Û°°ÛÛÛÛÛÛ°°
echo. °°°°°°°°°°°°°°°°°°°°°°
echo. °°ÛÛ°ÛÛ°ÛÛÛÛÛ°Û°°°°Û°°
echo. °°Û°Û°Û°Û°°°Û°ÛÛ°°°Û°°
echo. °°Û°°°Û°Û°°°Û°Û°Û°°Û°°
echo. °°Û°°°Û°ÛÛÛÛÛ°Û°°Û°Û°°
echo. °°Û°°°Û°Û°°°Û°Û°°Û°Û°°
echo. °°Û°°°Û°Û°°°Û°Û°°°ÛÛ°°
echo. °°Û°°°Û°Û°°°Û°Û°°°°Û°°
echo. °°°°°°°°°°°°°°°°°°°°°°
echo. °°°°°°°°°°°°°°°°°°°°°°
echo. °°°: SmartGenius :°°°°
echo. °°°  Corp.  2009  °°°°
echo. °°°°°°°°°°°°°°°°°°°°°°
ping -n 3 0.0.0.0 >nul
color 0e
Goto :Eof


:NoKey
 @mode con cols=30 lines=20
cls
echo.
echo  A file needed for the correct function
echo  of this Script is missing....
echo.
echo  CHOICE.COM
echo.
echo  Please Download it from Internet. ;)
pause
exit
Enjoy!

No comments:

Post a Comment