Advertisement
SmartGenius

BlockBreaker (aka Arkanoid) Batch Game

May 18th, 2012
1,406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 9.92 KB | None | 0 0
  1. @Echo off
  2. @title BlockBreaker v 1
  3. @mode con cols=28 lines=24
  4.  
  5. :: Batch Game - BlockBreaker v 1
  6. :: Coded by SmartGenius
  7. :: SmartGenius, Corp. 2010
  8.  
  9. If not exist "choice.com" (Goto :NoKey)
  10.  
  11. :Load
  12. Call :Logo
  13. Setlocal enabledelayedexpansion
  14. Set /a "LimX=18","LimY=16","TBound=1","LBound=1"
  15. Set /a "RBound=%LimX%-1"
  16. Set /a "BBound=%LimY%-3"
  17. Set NLevels=1
  18.  
  19. :Init
  20. For /l %%a in (0,1,%LimX%) do (
  21. For /l %%b in (0,1,%LimY%) do (
  22. Set X%%aY%%b= ))
  23. Set Ball=O
  24. Set Bound=Û
  25. Set Line=Û
  26. Set Lost=ù
  27. Set Point=*
  28.  
  29. :Levels
  30. Set /a L+=1
  31. Call :Level%L%
  32. Call :Graphic
  33. Set P%L%=%Movs%
  34. If "%LOS%"=="True" Goto :Lost
  35. If "%WIN%"=="True" Goto :Win
  36. If "%NXL%"=="True" Goto :End
  37. If "%L%"=="%NLevels%" Goto :Win
  38. ping -n 1 0.0.0.0 >nul
  39. Goto :Init
  40.  
  41. :Graphic
  42. Call :Clear
  43. Cls
  44. For /l %%d in (0,1,%LimY%) do (
  45. For /l %%e in (0,1,%LimX%) do (
  46. Set Lin_%%d=!Lin_%%d!!X%%eY%%d!))
  47. Echo.
  48. Echo.  BlockBreaker v 1 by Smart
  49. Echo.
  50. Echo.   Lives:%Lives%    Points:%Points%
  51. Echo.   ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  52. For /l %%f in (0,1,%LimY%) do (Echo.   º!Lin_%%f!º)
  53. Echo.   ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  54. Call :%Action%
  55. If "%Lives%"=="0" (Set LOS=True&Set NXL=True)
  56. If "%Dots%"=="0" (Set WIN=True&Set NXL=True)
  57. If "%NXL%"=="True" (Goto :Eof)
  58. Goto :Graphic
  59.  
  60. :Paused
  61. CHOICE /C:WADX /N >nul
  62. If "%errorlevel%"=="1" (Set Action=Playing)
  63. If "%errorlevel%"=="2" (call :LeftA)
  64. If "%errorlevel%"=="3" (call :RightA)
  65. If "%errorlevel%"=="4" (Set NXL=True)
  66. Goto :Eof
  67.  
  68. :Playing
  69. CHOICE /C:WADX /N /T:W,1 >nul
  70. If "%errorlevel%"=="1" (Set Action=Playing)
  71. If "%errorlevel%"=="2" (call :LeftB)
  72. If "%errorlevel%"=="3" (call :RightB)
  73. If "%errorlevel%"=="4" (Set NXL=True)
  74. Call :MovBall
  75. Goto :Eof
  76.  
  77. :RightA
  78. If ["%Table%"]==["%MaxTable%"] (Goto :Eof)
  79. For /f "tokens=1,5 delims=," %%u in ("%Table%") do (
  80. call :MovAX+ "%%u" "%%v" TB "!%%u!"
  81. call Set NewTable=!TB!,%Table%
  82. For /f "tokens=1-5 delims=," %%t in ("!NewTable!") do (Set NewTable=%%t,%%u,%%v,%%w,%%x)
  83. Set Table=!NewTable!
  84. call :MovAX+ "%CurPos%" "%CurPos%" CurPos "!%CurPos%!"
  85. )
  86. Goto :Eof
  87.  
  88. :RightB
  89. If ["%Table%"]==["%MaxTable%"] (Goto :Eof)
  90. For /f "tokens=1,5 delims=," %%u in ("%Table%") do (
  91. call :MovAX+ "%%u" "%%v" TB "!%%u!"
  92. call Set NewTable=!TB!,%Table%
  93. For /f "tokens=1-5 delims=," %%t in ("!NewTable!") do (Set NewTable=%%t,%%u,%%v,%%w,%%x)
  94. Set Table=!NewTable!)
  95. Goto :Eof
  96.  
  97. :LeftA
  98. If ["%Table%"]==["%MinTable%"] (Goto :Eof)
  99. For /f "tokens=1,5 delims=," %%u in ("%Table%") do (
  100. call :MovAX- "%%v" "%%u" TB "!%%v!"
  101. call Set NewTable=%Table%,!TB!
  102. For /f "tokens=2-6 delims=," %%t in ("!NewTable!") do (Set NewTable=%%t,%%u,%%v,%%w,%%x)
  103. Set Table=!NewTable!
  104. call :MovAX- "%CurPos%" "%CurPos%" CurPos "!%CurPos%!"
  105. )
  106. Goto :Eof
  107.  
  108. :LeftB
  109. If ["%Table%"]==["%MinTable%"] (Goto :Eof)
  110. For /f "tokens=1,5 delims=," %%u in ("%Table%") do (
  111. call :MovAX- "%%v" "%%u" TB "!%%v!"
  112. call Set NewTable=%Table%,!TB!
  113. For /f "tokens=2-6 delims=," %%t in ("!NewTable!") do (Set NewTable=%%t,%%u,%%v,%%w,%%x)
  114. Set Table=!NewTable!)
  115. Goto :Eof
  116.  
  117. :MovAX+
  118. For /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  119. Set /a MovX=%%p+1
  120. call Set NMovX=%%X!MovX!Y%%q%%
  121. If "!NMovX!"=="%Bound%" (Goto :Eof)
  122. If "!NMovX!"==" " (
  123. Set %~2=
  124. Set X!MovX!Y%%q=%~4
  125. Set %3=X!MovX!Y%%q))
  126. Goto :Eof
  127.  
  128. :MovAX-
  129. For /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  130. Set /a MovX=%%p-1
  131. call Set NMovX=%%X!MovX!Y%%q%%
  132. If "!NMovX!"=="%Bound%" (Goto :Eof)
  133. If "!NMovX!"==" " (
  134. Set %~2=
  135. Set X!MovX!Y%%q=%~4
  136. Set %3=X!MovX!Y%%q))
  137. Goto :Eof
  138.  
  139. :MovBall
  140. Set EOM=False
  141. Call :%NextMov% "%CurPos%"
  142. If "%EOM%"=="True" Goto :Eof
  143. Goto :MovBall
  144.  
  145. :Diag1
  146. For /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  147. Set /a MovX=%%p+1
  148. Set /a MovY=%%q+1
  149. call Set NMovX=%%X!MovX!Y%%q%%
  150. call Set NMovY=%%X%%pY!MovY!%%
  151. call Set NMovXY=%%X!MovX!Y!MovY!%%
  152.  
  153. If "!NMovXY!"=="%Bound%" (
  154. If "%%q"=="%BBound%" (Set NextMov=Diag3)
  155. If "%%p"=="%RBound%" (Set NextMov=Diag4)
  156. Goto :Eof)
  157.  
  158. If "!NMovY!"=="%Point%" (
  159. Set "X%%pY!MovY!= "
  160. Set NextMov=Diag3
  161. Set /a Points+=5
  162. Set /a Dots-=1
  163. Goto :Eof
  164. )
  165. If "!NMovX!"=="%Point%" (
  166. Set "X!MovX!Y%%q= "
  167. Set NextMov=Diag4
  168. Set /a Points+=5
  169. Set /a Dots-=1
  170. Goto :Eof
  171. )
  172. If "!NMovXY!"=="%Point%" (
  173. Set "X!MovX!Y!MovY!= "
  174. Set NextMov=Diag2
  175. Set /a Points+=5
  176. Set /a Dots-=1
  177. Goto :Eof
  178. )
  179.  
  180. If "!NMovXY!"==" " (
  181. Set %~1=
  182. Set X!MovX!Y!MovY!=%Ball%
  183. Set CurPos=X!MovX!Y!MovY!
  184. Set EOM=True)
  185. )
  186.  
  187. If "!NMovXY!"=="%Lost%" (
  188. Set %~1=
  189. Set /a Lives-=1
  190. call :ReSet
  191. Set EOM=True)
  192. )
  193. Goto :Eof
  194.  
  195. :Diag2
  196. For /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  197. Set /a MovX=%%p-1
  198. Set /a MovY=%%q-1
  199. call Set NMovX=%%X!MovX!Y%%q%%
  200. call Set NMovY=%%X%%pY!MovY!%%
  201. call Set NMovXY=%%X!MovX!Y!MovY!%%
  202.  
  203. If "!NMovXY!"=="%Bound%" (
  204. If "%%q"=="%TBound%" (Set NextMov=Diag4)
  205. If "%%p"=="%LBound%" (Set NextMov=Diag3)
  206. Goto :Eof)
  207.  
  208. If "!NMovY!"=="%Point%" (
  209. Set "X%%pY!MovY!= "
  210. Set NextMov=Diag4
  211. Set /a Points+=5
  212. Set /a Dots-=1
  213. Goto :Eof
  214. )
  215. If "!NMovX!"=="%Point%" (
  216. Set "X!MovX!Y%%q= "
  217. Set NextMov=Diag3
  218. Set /a Points+=5
  219. Set /a Dots-=1
  220. Goto :Eof
  221. )
  222. If "!NMovXY!"=="%Point%" (
  223. Set "X!MovX!Y!MovY!= "
  224. Set NextMov=Diag1
  225. Set /a Points+=5
  226. Set /a Dots-=1
  227. Goto :Eof
  228. )
  229.  
  230. If "!NMovXY!"==" " (
  231. Set %~1=
  232. Set X!MovX!Y!MovY!=%Ball%
  233. Set CurPos=X!MovX!Y!MovY!
  234. Set EOM=True)
  235. )
  236.  
  237. If "!NMovXY!"=="%Lost%" (
  238. Set %~1=
  239. Set /a Lives-=1
  240. call :ReSet
  241. Set EOM=True)
  242. )
  243. Goto :Eof
  244.  
  245. :Diag3
  246. For /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  247. Set /a MovX=%%p+1
  248. Set /a MovY=%%q-1
  249. call Set NMovX=%%X!MovX!Y%%q%%
  250. call Set NMovY=%%X%%pY!MovY!%%
  251. call Set NMovXY=%%X!MovX!Y!MovY!%%
  252.  
  253. If "!NMovXY!"=="%Bound%" (
  254. If "%%q"=="%TBound%" (Set NextMov=Diag1)
  255. If "%%p"=="%RBound%" (Set NextMov=Diag2)
  256. Goto :Eof)
  257.  
  258. If "!NMovY!"=="%Point%" (
  259. Set "X%%pY!MovY!= "
  260. Set NextMov=Diag1
  261. Set /a Points+=5
  262. Set /a Dots-=1
  263. Goto :Eof
  264. )
  265. If "!NMovX!"=="%Point%" (
  266. Set "X!MovX!Y%%q= "
  267. Set NextMov=Diag2
  268. Set /a Points+=5
  269. Set /a Dots-=1
  270. Goto :Eof
  271. )
  272. If "!NMovXY!"=="%Point%" (
  273. Set "X!MovX!Y!MovY!= "
  274. Set NextMov=Diag4
  275. Set /a Points+=5
  276. Set /a Dots-=1
  277. Goto :Eof
  278. )
  279.  
  280. If "!NMovXY!"==" " (
  281. Set %~1=
  282. Set X!MovX!Y!MovY!=%Ball%
  283. Set CurPos=X!MovX!Y!MovY!
  284. Set EOM=True)
  285. )
  286.  
  287. If "!NMovXY!"=="%Lost%" (
  288. Set %~1=
  289. Set /a Lives-=1
  290. call :ReSet
  291. Set EOM=True)
  292. )
  293. Goto :Eof
  294.  
  295. :Diag4
  296. For /f "tokens=1,2 delims=X,Y" %%p in ("%~1") do (
  297. Set /a MovX=%%p-1
  298. Set /a MovY=%%q+1
  299. call Set NMovX=%%X!MovX!Y%%q%%
  300. call Set NMovY=%%X%%pY!MovY!%%
  301. call Set NMovXY=%%X!MovX!Y!MovY!%%
  302.  
  303. If "!NMovXY!"=="%Bound%" (
  304. If "%%q"=="%BBound%" (Set NextMov=Diag2)
  305. If "%%p"=="%LBound%" (Set NextMov=Diag1)
  306. Goto :Eof)
  307.  
  308. If "!NMovY!"=="%Point%" (
  309. Set "X%%pY!MovY!= "
  310. Set NextMov=Diag2
  311. Set /a Points+=5
  312. Set /a Dots-=1
  313. Goto :Eof
  314. )
  315. If "!NMovX!"=="%Point%" (
  316. Set "X!MovX!Y%%q= "
  317. Set NextMov=Diag1
  318. Set /a Points+=5
  319. Set /a Dots-=1
  320. Goto :Eof
  321. )
  322. If "!NMovXY!"=="%Point%" (
  323. Set "X!MovX!Y!MovY!= "
  324. Set NextMov=Diag3
  325. Set /a Points+=5
  326. Set /a Dots-=1
  327. Goto :Eof
  328. )
  329.  
  330. If "!NMovXY!"==" " (
  331. Set %~1=
  332. Set X!MovX!Y!MovY!=%Ball%
  333. Set CurPos=X!MovX!Y!MovY!
  334. Set EOM=True)
  335. )
  336.  
  337. If "!NMovXY!"=="%Lost%" (
  338. Set %~1=
  339. Set /a Lives-=1
  340. call :ReSet
  341. Set EOM=True)
  342. )
  343. Goto :Eof
  344.  
  345. :Clear
  346. For /l %%m in (0,1,%LimY%) do (Set Lin_%%m=)
  347. Goto :Eof
  348.  
  349. :Reset
  350. Set CurPos=X8Y13
  351. Set Table=X10Y14,X9Y14,X8Y14,X7Y14,X6Y14
  352. For /l %%h in (1,1,17) do (Set X%%hY14= )
  353. For %%k in (%Init%) do (Set %%k=%Line%)
  354. For /f "tokens=1 delims=," %%j in ("%Init%") do (Set %%j=%Ball%)
  355. Set Action=Paused
  356. Goto :Eof
  357.  
  358. :Lost
  359. msg * Perdiste !
  360. Goto :End
  361.  
  362. :Win
  363. msg * Has Ganado !
  364. Goto :End
  365.  
  366. :End
  367. msg * Gracias por Jugar BlockBreaker v1 by SmartGenius
  368. Endlocal
  369. Exit
  370.  
  371. :Level1
  372. Set /a "Movs=0","Points=0","Dots=36","Lives=3"
  373. Set CurPos=X8Y13
  374. Set Table=X10Y14,X9Y14,X8Y14,X7Y14,X6Y14
  375. Set MaxTable=X17Y14,X16Y14,X15Y14,X14Y14,X13Y14
  376. Set MinTable=X5Y14,X4Y14,X3Y14,X2Y14,X1Y14
  377. Set Init=X8Y13,X6Y14,X7Y14,X8Y14,X9Y14,X10Y14
  378. Set Dir=N
  379. Set Action=Paused
  380. Set NextMov=Diag3
  381. For /l %%e in (%LBound%,1,%RBound%) do (Set X%%eY1= )
  382. For /l %%f in (6,1,10) do (Set X%%fY2=%Bound%)
  383. For %%k in (%Init%) do (Set %%k=%Line%)
  384. For /f "tokens=1 delims=," %%j in ("%Init%") do (Set %%j=%Ball%)
  385. For /l %%i in (0,1,%LimX%) do (
  386. Set X0Y%%i=%Bound%
  387. Set X%LimX%Y%%i=%Bound%
  388. Set X%%iY0=%Bound%
  389. Set X%%iY%LimY%=%Bound%)
  390. For /l %%l in (2,1,16) do (Set X%%lY2=%Point%)
  391. For /l %%m in (4,1,14) do (Set X%%mY3=%Point%)
  392. For /l %%n in (6,1,12) do (Set X%%nY4=%Point%)
  393. For /l %%o in (8,1,10) do (Set X%%oY5=%Point%)
  394. For /l %%r in (1,1,17) do (Set X%%rY15=%Lost%)
  395. Goto :Eof
  396.  
  397. :Logo
  398. Cls
  399. Color 0b
  400. Echo.
  401. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  402. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  403. Echo. °°°ÛÛÛ°°Û°°°ÛÛÛ°°ÛÛ°Û°°Û°°
  404. Echo. °°°Û°°Û°Û°°°Û°Û°Û°°°Û°Û°°°
  405. Echo. °°°ÛÛÛ°°Û°°°Û°Û°Û°°°ÛÛ°°°°
  406. Echo. °°°Û°°Û°Û°°°Û°Û°Û°°°Û°Û°°°
  407. Echo. °°°ÛÛÛ°°ÛÛÛ°ÛÛÛ°°ÛÛ°Û°°Û°°
  408. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  409. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  410. Echo. °°°°°°B°R°E°A°K°E°R°°°°°°°
  411. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  412. Echo. °°°±°±°±°±°±°±°±°±°±°±°±°°
  413. Echo. °°±°±°±°±°±°±°±°±°±°±°±°°°
  414. Echo. °°°±°±°±°±°±°±°±°±°±°±°±°°
  415. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  416. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  417. Echo. °°°°°°²°°°°°°°°°°°°°°°°°°°
  418. Echo. °°°°ÛÛÛÛÛ°°°°°°°°°°°°°°°°°
  419. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  420. Echo. °°°°°: SmartGenius :°°°°°°
  421. Echo. °°°°°  Corp.  2010  °°°°°°
  422. Echo. °°°°°°°°°°°°°°°°°°°°°°°°°°
  423. ping -n 3 0.0.0.0 >nul
  424. Goto :Eof
  425.  
  426. :NoKey
  427. @mode con cols=30 lines=20
  428. cls
  429. Echo.
  430. Echo  Uno de los archivos necesarios para el
  431. Echo  funcionamiento de este Script no se
  432. Echo  encuentra.
  433. Echo.
  434. Echo  CHOICE.COM
  435. Echo.
  436. Echo  Por favor descargue una copia del Comando
  437. Echo  CHOICE de Internet...
  438. Echo.
  439. pause
  440. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement