无第三方,单bat文件,双窗口
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
@echo off ::**************Happy's俄罗斯方块*********** REM 使用说明: REM A左D右;W旋转;S加速下落; REM Q退出;P暂停;方向键继续; ::**************Settings高级设置************ REM 设置窗体 title &setlocal enabledelayedexpansion mode con cols=35 lines=25&color F0 REM 开启防闪烁,用于画质增强 set F1=1 REM 设置时钟T, 越小下落越快 set T=190 REM 默认皮肤 set "SKIN= ■" REM 设置旋转体系:依次为TGM、SRS(第二代超级形码) ::set "SHAPE=0x159D0x89AB0x159D0x89AB0x126A0x48560x159A0x45260x926A0x456A0x15920x04560x48590x48590x48590x48590x59260x01560x59260x01560x41590x45960x15960x41560x156A0x41520x156A0x4152" set "SHAPE=0x159D0x89AB0x26AE0x45670x01590x48560x159A0x45260x81590x456A0x15920x04560x48590x48590x48590x48590x48150x459A0x59260x01560x41590x45960x15960x41560x04590x85960x156A0x4152" ::**************方向控制台****************** if "%1"=="CONTROLP" ( title &MODE CON cols=15 lines=1 for /l %%i in (1,1,100000) do ( set "KEY=" for /f "delims=" %%a in ('xcopy /W . 2^>NUL') do ( if not defined KEY ( set "KEY=%%a"&set "KEY=!KEY:~-1!" echo %%i!KEY!>key.ini&if /i "!KEY!"=="Q" (exit) ) ) ) ) start "" "%~f0" CONTROLP ::**************先导程序******************** REM 准备元素 set/a "LEVEL=1,SCORE=0, RU=!random!%%7,RI=(!random!%%4)*6" for /l %%N in (0,24,144) do (set/a "N=%%N/24"&set "SHAPE!N!=!SHAPE:~%%N,24!") for /l %%N in (0,1,1 ) do (set "E%%N=!SKIN:~%%N,1!") for /l %%N in (1,1,10 ) do (set "LINES=!LINES!━" ) for /l %%N in (1,1,300 ) do (set "SPACE=!SPACE!" ) REM 构建显存 :DISPLAY_RAM for /l %%j in (0,1,21) do ( set "#[%%j]=1" for /l %%i in (0,1,11) do ( set/a "BOUNDARY=(%%i)*(%%i-11)*(%%j-21)" if !BOUNDARY! equ 0 (set "P[%%i][%%j]=1") else (set "P[%%i][%%j]=0") ) ) ::**************主体程序******************** REM ~~~随机块体 :RANDOM_SHAPE set/a "NU=RU,NI=RI, RU=!random!%%7,RI=(!random!%%4)*6, X=4,Y=1" echo RW>key.ini REM ~~~计数面板 set "V1=!LEVEL! " set "V2=!SCORE! " set "READM[3]=LEVEL:!V1:~0,3!" set "READM[5]=SCORE:!V2:~0,3!" set "READM[7]=NEXT" REM ~~~读取按键 :READKEY set/a "Dx=0,Dy=0" set/p KEY=<key.ini if /i "!KEY:~-1!"=="P" (goto :READKEY) if not "!PRE_KEY!"=="!KEY!" ( set PRE_KEY=!KEY! if /i "!KEY:~-1!"=="A" (set "Dx=-1") if /i "!KEY:~-1!"=="D" (set "Dx=1" ) if /i "!KEY:~-1!"=="W" ( set "Cache=!SHAPE%NU%:~%NI%,6!" set/a "Xf=X,NI+=6,NI%%=24" REM ~~~16进制超级转码 for /l %%j in (0,1,3) do ( set/a "POS[%%j]=Cache&0xF, Cache=Cache>>4" 2>NUL ) if "!KEY!"=="RW" ( set "Cache2=!SHAPE%RU%:~%RI%,6!" for /l %%J in (0,1,3) do ( set/a "RPOS[%%J]=Cache2&0xF, Cache2=Cache2>>4" 2>NUL for /l %%I in (0,1,3) do ( set "R[%%I][%%J]=0" ) ) for %%p in (!RPOS[0]!,!RPOS[1]!,!RPOS[2]!,!RPOS[3]!) do ( set/a "RPOS_X=%%p>>2,RPOS_Y=%%p&0x3" set "R[!RPOS_X!][!RPOS_Y!]=1" ) for /l %%J in (0,1,3) do ( set "TP=" for /l %%I in (0,1,3) do ( set "TP=!TP!!R[%%I][%%J]!" ) set "TP=!TP:0=%E0%!" set "TP=!TP:1=%E1%!" set/a "SN=%%J+8" set "READM[!SN!]=!TP!" ) echo WO>key.ini for /l %%j in (8,1,11) do (set/a "#[%%j]=1") ) goto :DATA_PROCESSING ) if /i "!KEY:~-1!"=="Q" (exit) ) if /i "!KEY:~-1!"=="S" (set "Dy=1"&goto :DATA_PROCESSING) REM ~~~下落体系 if !Mark! equ 0 ( set "Mark=1" set "T1=!time:~9,2!" ) else ( set/a "TS=2!time:~9,2!-1!T1!" set/a "TS=1!TS:~-2!" if !TS! lss !T! (set "Dy=0") else (set/a "Dy=1,Mark=0") ) if !Dx! equ 0 if !Dy! equ 0 (goto :READKEY) REM ~~~数据处理 :DATA_PROCESSING SETLOCAL for %%p in (!POS[0]!,!POS[1]!,!POS[2]!,!POS[3]!) do ( set/a "POS_X=(%%p>>2)+X+Dx,POS_Y=(%%p&0x3)+Y+Dy" set/a "CHE=P[!POS_X!][!POS_Y!]" if !CHE! equ 0 ( set "P[!POS_X!][!POS_Y!]=1" ) else ( if !Dx! neq 0 ( ENDLOCAL goto :READKEY ) if !Dy! equ 1 ( ENDLOCAL if !Y! lss 2 ( echo GAME OVER! ping -n 2 127.1>NUL goto :DISPLAY_RAM ) REM ~~~固化块体 set "POS_Y_MAX=0" for %%P in (!POS[0]!,!POS[1]!,!POS[2]!,!POS[3]!) do ( set/a "POS_X=(%%P>>2)+X,POS_Y=(%%P&0x3)+Y" if !POS_Y_MAX! lss !POS_Y! (set "POS_Y_MAX=!POS_Y!") set "P[!POS_X!][!POS_Y!]=1" ) REM ~~~关卡得分 for /l %%J in (!Y!,1,!POS_Y_MAX!) do ( set "TP=" for /l %%I in (1,1,10) do ( set "TP=!TP!!P[%%I][%%J]!" ) if "!TP!"=="1111111111" ( set/a "SCORE+=10" set "#%%J=1" if !SCORE! equ 400 ( for /l %%N in (!Y!,1,!POS_Y_MAX!) do (set "#%%N=") set/a "SCORE=0,LEVEL+=1,T-=10" goto :DISPLAY_RAM ) ) ) REM ~~~极品消行 for /l %%J in (20,-1,5) do ( if defined #%%J ( set "#%%J=" set/a "MarkJ=%%J-1, GK=1" for /l %%N in (1,1,3) do ( if defined #!MarkJ! (set/a "MarkJ-=1") ) set "#!MarkJ!=1" for /l %%I in (1,1,10) do ( set/a "P[%%I][%%J]=P[%%I][!MarkJ!]" ) ) ) if defined GK (for /l %%J in (20,-1,5) do (set "#[%%J]=1")&set "GK=") goto :RANDOM_SHAPE ) if /i "!KEY:~-1!"=="W" ( ENDLOCAL echo OW>key.ini set/a "NI=(NI+12)%%24" goto :READKEY ) ) ) REM ~~~绘图引擎 if !F1! equ 1 (2>NUL echo !SPACE!&set/p=<NUL) else (cls) echo ┏%LINES%┓ for /l %%j in (0,1,5) do (set/a "MARK_Y=Y+%%j,#[!MARK_Y!]=1") for /l %%j in (1,1,20) do ( if not defined #[%%j] ( echo; ) else ( set "TP=" for /l %%i in (1,1,10) do (set "TP=!TP!!P[%%i][%%j]!") set "TP=!TP:1=%E1%!" set "TP=!TP:0=%E0%!" echo ┃!TP!┃!READM[%%j]! ) ) echo ┗%LINES%┛ echo CopyRight@2016~2018 BY HAPPY ENDLOCAL&for /l %%j in (1,1,20) do (set "#[%%j]=") set/a "X+=Dx,Y+=Dy" goto :READKEY |
转载自【批处理之家】 happy886rr 发表于 2016-10-3 11:59
http://www.bathome.net/thread-41917-1-1.html
发表回复