Advertisement
SmartGenius

Pacman like Batch Game

May 18th, 2012
11,494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 9.21 KB | None | 0 0
  1. @echo off
  2. @title PacMan v 1
  3. @mode con cols=24 lines=24
  4. @::Juego Batch PacMan
  5. @::Another Batch Game
  6. @::by ::SmartGenius ::
  7.  
  8. if not exist "choice.com" (Goto :NoKey)
  9.  
  10. :load
  11. call :Logo
  12. setlocal enabledelayedexpansion
  13. set LimX=16
  14. set LimY=16
  15. set NLevels=1
  16.  
  17. :init
  18. for /l %%a in (0,1,%LimX%) do (
  19. for /l %%b in (0,1,%LimY%) do (
  20. set X%%aY%%b=.))
  21. set Player=
  22. set Bound=Û
  23. set Box=
  24. set Ghost=
  25.  
  26. :Levels
  27. set /a L+=1
  28. Call :Level%L%
  29. Call :Graphic
  30. set P%L%=%Movs%
  31. if "%NXL%"=="True" Goto :End
  32. if "%L%"=="%NLevels%" Goto :Win
  33. ping -n 1 0.0.0.0 >nul
  34. Goto :Init
  35.  
  36. :Graphic
  37. Call :Clear
  38. cls
  39. for /l %%d in (0,1,%LimY%) do (
  40. for /l %%e in (0,1,%LimX%) do (
  41. set Lin_%%d=!Lin_%%d!!X%%eY%%d!))
  42. echo.
  43. echo.  Pacman v 1 by Smart
  44. echo.
  45. echo.  Vidas:%Lives%   Puntos:%Points%
  46. echo.   ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  47. for /l %%f in (0,1,%LimY%) do (echo.   º!Lin_%%f!º)
  48. echo.   ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  49. CHOICE /C:WASDX /N /T:%Dir%,1 >nul
  50. if "%errorlevel%"=="1" (call :MovY- "%CurPos%" CurPos&set Dir=W)
  51. if "%errorlevel%"=="2" (call :MovX- "%CurPos%" CurPos&set Dir=A)
  52. if "%errorlevel%"=="3" (call :MovY+ "%CurPos%" CurPos&set Dir=S)
  53. if "%errorlevel%"=="4" (call :MovX+ "%CurPos%" CurPos&set Dir=D)
  54. if "%errorlevel%"=="5" (set NXL=True&Goto :Eof)
  55. Call :MovGhost
  56. for %%w in (%Boxes%) do (
  57. if not "!%%w!"=="%Box%" (
  58. if "!%%w!"=="." (set %%w=%Box%)))
  59. set /a NCK=%Points% %% 7
  60. if "%NCK%"=="0" set Cki=False
  61. if "%EOG%"=="True" (msg * Perdiste&Goto :Eof)
  62. Goto :Graphic
  63.  
  64. ::Logica de Movimiento en el Plano
  65. ::Coded by :: SmartGenius ::
  66.  
  67. :MovX+
  68. for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  69. set /a MovX=%%p+1
  70. call set NMovX=%%X!MovX!Y%%q%%
  71.  
  72. if "!NMovX!"=="%Bound%" (Goto :Eof)
  73.  
  74. if "!NMovX!"=="%Ghost%" (
  75. if !%~1!==%Player% (
  76. if "%Cki%"=="True" (
  77. set %~1=
  78. set X!MovX!Y%%q=%Player%
  79. set %2=X!MovX!Y%%q
  80. set /a Points+=10
  81. call :UnGhost "X!MovX!Y%%q"
  82. )
  83. if "%Cki%"=="False" (
  84. set %~1=
  85. set /a Lives-=1
  86. set %Init%=%Player%
  87. set %2=%Init%
  88. if "!Lives!"=="0" (set EOG=True)
  89. )))
  90.  
  91. if "!NMovX!"=="." (
  92. if !%~1!==%Player% (
  93. set %~1=
  94. set /a Points+=2
  95. set X!MovX!Y%%q=%Player%
  96. set %2=X!MovX!Y%%q)
  97. if !%~1!==%Ghost% (
  98. set %~1=.
  99. set X!MovX!Y%%q=%Ghost%
  100. set %2=X!MovX!Y%%q))
  101.  
  102. if "!NMovX!"==" " (
  103. if !%~1!==%Player% (
  104. set %~1=
  105. set X!MovX!Y%%q=%Player%
  106. set %2=X!MovX!Y%%q)
  107. if !%~1!==%Ghost% (
  108. set %~1=
  109. set X!MovX!Y%%q=%Ghost%
  110. set %2=X!MovX!Y%%q))
  111.  
  112.  
  113. if "!NMovX!"=="%Box%" (
  114. if !%~1!==%Player% (
  115. set %~1=
  116. set /a Points+=5
  117. set Cki=True
  118. set X!MovX!Y%%q=%Player%
  119. set %2=X!MovX!Y%%q)
  120. if !%~1!==%Ghost% (
  121. set %~1=.
  122. set X!MovX!Y%%q=%Ghost%
  123. set %2=X!MovX!Y%%q)))
  124.  
  125. if !%~1!==%Player% set /a Movs+=1
  126. Goto :Eof
  127.  
  128.  
  129. :MovX-
  130. for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  131. set /a MovX=%%p-1
  132. call set NMovX=%%X!MovX!Y%%q%%
  133.  
  134. if "!NMovX!"=="%Bound%" (Goto :Eof)
  135.  
  136. if "!NMovX!"=="%Ghost%" (
  137. if !%~1!==%Player% (
  138. if "%Cki%"=="True" (
  139. set %~1=
  140. set X!MovX!Y%%q=%Player%
  141. set %2=X!MovX!Y%%q
  142. set /a Points+=10
  143. call :UnGhost "X!MovX!Y%%q"
  144. )
  145. if "%Cki%"=="False" (
  146. set %~1=
  147. set /a Lives-=1
  148. set %Init%=%Player%
  149. set %2=%Init%
  150. if "!Lives!"=="0" (set EOG=True)
  151. )))
  152.  
  153. if "!NMovX!"=="." (
  154. if !%~1!==%Player% (
  155. set %~1=
  156. set /a Points+=2
  157. set X!MovX!Y%%q=%Player%
  158. set %2=X!MovX!Y%%q)
  159. if !%~1!==%Ghost% (
  160. set %~1=.
  161. set X!MovX!Y%%q=%Ghost%
  162. set %2=X!MovX!Y%%q))
  163.  
  164. if "!NMovX!"==" " (
  165. if !%~1!==%Player% (
  166. set %~1=
  167. set X!MovX!Y%%q=%Player%
  168. set %2=X!MovX!Y%%q)
  169. if !%~1!==%Ghost% (
  170. set %~1=
  171. set X!MovX!Y%%q=%Ghost%
  172. set %2=X!MovX!Y%%q))
  173.  
  174.  
  175. if "!NMovX!"=="%Box%" (
  176. if !%~1!==%Player% (
  177. set %~1=
  178. set /a Points+=5
  179. set Cki=True
  180. set X!MovX!Y%%q=%Player%
  181. set %2=X!MovX!Y%%q)
  182. if !%~1!==%Ghost% (
  183. set %~1=.
  184. set X!MovX!Y%%q=%Ghost%
  185. set %2=X!MovX!Y%%q)))
  186.  
  187. if !%~1!==%Player% set /a Movs+=1
  188. Goto :Eof
  189.  
  190.  
  191. :MovY+
  192. for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  193. set /a MovY=%%q+1
  194. call set NMovY=%%X%%pY!MovY!%%
  195.  
  196. if "!NMovY!"=="%Bound%" (Goto :Eof)
  197.  
  198. if "!NMovY!"=="%Ghost%" (
  199. if !%~1!==%Player% (
  200. if "%Cki%"=="True" (
  201. set %~1=
  202. set X%%pY!MovY!=%Player%
  203. set %2=X%%pY!MovY!
  204. set /a Points+=10
  205. call :UnGhost "X%%pY!MovY!"
  206. )
  207. if "%Cki%"=="False" (
  208. set %~1=
  209. set /a Lives-=1
  210. set %Init%=%Player%
  211. set %2=%Init%
  212. if "!Lives!"=="0" (set EOG=True)
  213. )))
  214.  
  215. if "!NMovY!"=="." (
  216. if !%~1!==%Player% (
  217. set %~1=
  218. set /a Points+=2
  219. set X%%pY!MovY!=%Player%
  220. set %2=X%%pY!MovY!)
  221. if !%~1!==%Ghost% (
  222. set %~1=.
  223. set X%%pY!MovY!=%Ghost%
  224. set %2=X%%pY!MovY!))
  225.  
  226. if "!NMovY!"==" " (
  227. if !%~1!==%Player% (
  228. set %~1=
  229. set X%%pY!MovY!=%Player%
  230. set %2=X%%pY!MovY!)
  231. if !%~1!==%Ghost% (
  232. set %~1=
  233. set X%%pY!MovY!=%Ghost%
  234. set %2=X%%pY!MovY!))
  235.  
  236.  
  237. if "!NMovY!"=="%Box%" (
  238. if !%~1!==%Player% (
  239. set %~1=
  240. set /a Points+=5
  241. set Cki=True
  242. set X%%pY!MovY!=%Player%
  243. set %2=X%%pY!MovY!)
  244. if !%~1!==%Ghost% (
  245. set %~1=.
  246. set X%%pY!MovY!=%Ghost%
  247. set %2=X%%pY!MovY!)))
  248.  
  249. if !%~1!==%Player% set /a Movs+=1
  250. Goto :Eof
  251.  
  252.  
  253. :MovY-
  254. for /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  255. set /a MovY=%%q-1
  256. call set NMovY=%%X%%pY!MovY!%%
  257.  
  258. if "!NMovY!"=="%Bound%" (Goto :Eof)
  259.  
  260. if "!NMovY!"=="%Ghost%" (
  261. if !%~1!==%Player% (
  262. if "%Cki%"=="True" (
  263. set %~1=
  264. set X%%pY!MovY!=%Player%
  265. set %2=X%%pY!MovY!
  266. set /a Points+=10
  267. call :UnGhost "X%%pY!MovY!"
  268. )
  269. if "%Cki%"=="False" (
  270. set %~1=
  271. set /a Lives-=1
  272. set %Init%=%Player%
  273. set %2=%Init%
  274. if "!Lives!"=="0" (set EOG=True)
  275. )))
  276.  
  277. if "!NMovY!"=="." (
  278. if !%~1!==%Player% (
  279. set %~1=
  280. set /a Points+=2
  281. set X%%pY!MovY!=%Player%
  282. set %2=X%%pY!MovY!)
  283. if !%~1!==%Ghost% (
  284. set %~1=.
  285. set X%%pY!MovY!=%Ghost%
  286. set %2=X%%pY!MovY!))
  287.  
  288. if "!NMovY!"==" " (
  289. if !%~1!==%Player% (
  290. set %~1=
  291. set X%%pY!MovY!=%Player%
  292. set %2=X%%pY!MovY!)
  293. if !%~1!==%Ghost% (
  294. set %~1=
  295. set X%%pY!MovY!=%Ghost%
  296. set %2=X%%pY!MovY!))
  297.  
  298.  
  299. if "!NMovY!"=="%Box%" (
  300. if !%~1!==%Player% (
  301. set %~1=
  302. set /a Points+=5
  303. set Cki=True
  304. set X%%pY!MovY!=%Player%
  305. set %2=X%%pY!MovY!)
  306. if !%~1!==%Ghost% (
  307. set %~1=.
  308. set X%%pY!MovY!=%Ghost%
  309. set %2=X%%pY!MovY!)))
  310.  
  311. if !%~1!==%Player% set /a Movs+=1
  312. Goto :Eof
  313.  
  314.  
  315. :MovGhost
  316. set NGG=0
  317. for %%z in (%Ghosts%) do (
  318. set /a NG+=1
  319. set Ghost!NG!=%%z)
  320. :MovGhost2
  321. set /a NGG+=1
  322. set /a GoMov=%random:~-1% %% 4
  323. if "!GoMov!"=="0" Call :MovX+ %%Ghost!NGG!%% Ghost!NGG!
  324. if "!GoMov!"=="1" Call :MovX- %%Ghost!NGG!%% Ghost!NGG!
  325. if "!GoMov!"=="2" Call :MovY+ %%Ghost!NGG!%% Ghost!NGG!
  326. if "!GoMov!"=="3" Call :MovY- %%Ghost!NGG!%% Ghost!NGG!
  327. )
  328. if "%NGG%"=="4" (
  329. set Ghosts=%Ghost1%,%Ghost2%,%Ghost3%,%Ghost4%
  330. set NG=0
  331. Goto :Eof)
  332. Goto :MovGhost2
  333.  
  334. :UnGhost
  335. set Ghosts=!Ghosts:%~1=X8Y7!
  336. for %%g in (%Ghosts%) do (set %%g=%Ghost%)
  337. Goto :Eof
  338.  
  339. :Clear
  340. for /l %%m in (0,1,%LimY%) do (set Lin_%%m=)
  341. Goto :Eof
  342.  
  343. :Win
  344.  
  345. :End
  346. msg * Gracias por Jugar PacMan v1 by :: SmartGenius::
  347. endlocal
  348. exit
  349.  
  350. ::Niveles del Juego PacMan
  351. ::Coordenadas Cartesianas
  352. ::Coded by :: SmartGenius ::
  353.  
  354. ::Inicio Nivel 1
  355. :Level1
  356. set Movs=0
  357. set Points=0
  358. set X2Y15=%Player%
  359. set CurPos=X2Y15
  360. set Init=X2Y15
  361. set Lives=3
  362. set Cki=False
  363. set Dir=D
  364. set Ghosts=X2Y11,X6Y9,X6Y7,X10Y6
  365. set Boxes=X2Y1,X2Y9,X14Y1,X14Y9,X14Y15
  366. for %%g in (%Ghosts%) do (set %%g=%Ghost%)
  367. for %%h in (%Boxes%) do (set %%h=%Box%)
  368. for /l %%i in (0,1,16) do (
  369. set X0Y%%i=%Bound%
  370. set X1Y%%i=%Bound%
  371. set X15Y%%i=%Bound%
  372. set X16Y%%i=%Bound%
  373. set X%%iY0=%Bound%
  374. set X%%iY16=%Bound%)
  375. for %%j in (3,4,5,6,10,11,12,13) do (
  376. set X%%jY2=%Bound%
  377. set X%%jY3=%Bound%
  378. set X%%jY10=%Bound%
  379. set X%%jY14=%Bound%)
  380. for %%k in (X8Y1,X8Y2,X8Y3,X3Y5,X3Y6,X3Y7,X3Y8,X5Y5,X5Y6,X5Y7,X5Y8,X6Y5,X7Y5) do (set %%k=%Bound%)
  381. for %%l in (X6Y8,X7Y8,X8Y8,X9Y8,X10Y8,X9Y5,X10Y5,X11Y5,X11Y6,X11Y7,X11Y8,X13Y5) do (set %%l=%Bound%)
  382. for %%m in (X13Y6,X13Y7,X13Y8,X7Y10,X9Y10,X3Y12,X3Y13,X5Y12,X6Y12,X7Y12,X8Y12) do (set %%m=%Bound%)
  383. for %%n in (X9Y12,X10Y12,X11Y12,X8Y13,X8Y14,X13Y12,X13Y13) do (set %%n=%Bound%)
  384. for %%o in (X6Y6,X7Y6,X8Y5,X8Y6,X9Y6,X7Y7,X8Y7,X9Y7,X10Y7) do (set %%o= )
  385. Goto :Eof
  386.  
  387. ::Fin Nivel 1
  388.  
  389. ::Fin de Coordenadas
  390.  
  391. :Logo
  392. color 0a
  393. cls
  394. echo.
  395. echo. °°°°°°°°°°°°°°°°°°°°°°
  396. echo. °°°°°°°°°°°°°°°°°°°°°°
  397. echo. °ÛÛÛÛÛ°ÛÛÛÛÛ°°ÛÛÛÛÛÛ°°
  398. echo. °Û°°°Û°Û°°°Û°ÛÛÛÛÛÛ°°°
  399. echo. °Û°°°Û°Û°°°Û°ÛÛÛÛ°°°°°
  400. echo. °ÛÛÛÛÛ°ÛÛÛÛÛ°ÛÛÛ°°°°°°
  401. echo. °Û°°°°°Û°°°Û°ÛÛÛÛ°°°°°
  402. echo. °Û°°°°°Û°°°Û°ÛÛÛÛÛÛ°°°
  403. echo. °Û°°°°°Û°°°Û°°ÛÛÛÛÛÛ°°
  404. echo. °°°°°°°°°°°°°°°°°°°°°°
  405. echo. °°ÛÛ°ÛÛ°ÛÛÛÛÛ°Û°°°°Û°°
  406. echo. °°Û°Û°Û°Û°°°Û°ÛÛ°°°Û°°
  407. echo. °°Û°°°Û°Û°°°Û°Û°Û°°Û°°
  408. echo. °°Û°°°Û°ÛÛÛÛÛ°Û°°Û°Û°°
  409. echo. °°Û°°°Û°Û°°°Û°Û°°Û°Û°°
  410. echo. °°Û°°°Û°Û°°°Û°Û°°°ÛÛ°°
  411. echo. °°Û°°°Û°Û°°°Û°Û°°°°Û°°
  412. echo. °°°°°°°°°°°°°°°°°°°°°°
  413. echo. °°°°°°°°°°°°°°°°°°°°°°
  414. echo. °°°: SmartGenius :°°°°
  415. echo. °°°  Corp.  2009  °°°°
  416. echo. °°°°°°°°°°°°°°°°°°°°°°
  417. ping -n 3 0.0.0.0 >nul
  418. color 0e
  419. Goto :Eof
  420.  
  421.  
  422. :NoKey
  423. @mode con cols=30 lines=20
  424. cls
  425. echo.
  426. echo  Uno de los archivos necesarios para el
  427. echo  funcionamiento de este Script no se
  428. echo  encuentra.
  429. echo.
  430. echo  CHOICE.COM
  431. echo.
  432. echo  Por favor descargue una copia del Comando
  433. echo  CHOICE de Internet...
  434. echo.
  435. pause
  436. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement