标题: [特效代码] [分享]choice应用小示例-批处理版坦克特效 [打印本页]
作者: batman 时间: 2009-10-18 00:16 标题: [分享]choice应用小示例-批处理版坦克特效
说明:
本批是为对choice.exe应用示例而写,运行前请先确定你的系统中有choice.exe,
没有的请先到本论坛下载choice.exe(解压到windows\system32下),链接如下:
http://bbs.bathome.net/viewthread.php?tid=1726&highlight=choice- @echo off&setlocal enabledelayedexpansion
- title 可移动的坦克&color 02
- for /l %%a in (1,1,30) do set "k=!k! "
- set /a num=10
- set "t1= ‖"
- set "t2= ┐_‖_┌"
- set "t3=┋o nn o┋"
- set "t4=┋(∩)┋"
- set "t5= ┘~WW~└"
- :begin
- cls
- echo 方向控制为:w上s下a左d右(z键退出)&echo.
- for /l %%a in (1,1,%num%) do echo.
- for /l %%a in (1,1,5) do echo %k%!t%%a!
- choice /n /c "wsadz"
- if %errorlevel% equ 1 if %num% neq 0 set /a num-=1
- if %errorlevel% equ 2 if %num% neq 17 set /a num+=1"
- if %errorlevel% equ 3 if "%k:~1%" neq "" set "k=%k:~1%"
- if %errorlevel% equ 4 if "%k:~67%" equ "" set "k=%k% "
- if %errorlevel% equ 5 goto :eof
- goto begin
复制代码
[ 本帖最后由 batman 于 2009-10-19 00:53 编辑 ]
作者: jiangchun 时间: 2009-10-18 00:44
学习了,谢谢楼主!
作者: batman 时间: 2009-10-18 00:51
再附上不用choice的版本(使用debug模拟choice),大家可比较下效果:- @echo off&setlocal enabledelayedexpansion
- title 可移动的坦克&color 02
- chcp 437>nul
- graftabl 936>nul
- for /l %%a in (1,1,30) do set "k=!k! "
- set /a num=10
- set "t1= ‖"
- set "t2= ┐_‖_┌"
- set "t3=┋o nn o┋"
- set "t4=┋(∩)┋"
- set "t5= ┘~WW~└"
- :begin
- cls
- echo 方向控制为:w上s下a左d右(z键退出)&echo.
- for /l %%a in (1,1,%num%) do echo.
- for /l %%a in (1,1,5) do echo %k%!t%%a!
- echo exit|cmd/kprompt $_e 100 CD 16 B4 4C CD 21$_g$_|debug>nul
- if %errorlevel% equ 119 if %num% neq 0 set /a num-=1
- if %errorlevel% equ 115 if %num% neq 17 set /a num+=1"
- if %errorlevel% equ 97 if "%k:~1%" neq "" set "k=%k:~1%"
- if %errorlevel% equ 100 if "%k:~67%" equ "" set "k=%k% "
- if %errorlevel% equ 122 goto :eof
- goto begin
复制代码
作者: jiangchun 时间: 2009-10-18 01:15
第一个运行:不停的闪,操作不了,提示CHOICE不是内部命令
第二个运行OK
作者: jiangchun 时间: 2009-10-18 01:16
真不好意思,没有下载choice.exe
作者: canyuexiaolang 时间: 2009-10-18 11:41
坦克不是螃蟹...要是头能拐弯就好了
作者: batman 时间: 2009-10-18 17:45 标题: 加入射击效果
大家可以通过改变for /l %%a in (1,1,50) do echo>nul处"50"的值来调节射击速度:- @echo off&setlocal enabledelayedexpansion
- title 坦克&color 02
- for /l %%a in (1,1,30) do set "k=!k! "
- set /a num=10
- set "t1= ‖"
- set "t2= ┐_‖_┌"
- set "t3=┋o nn o┋"
- set "t4=┋(∩)┋"
- set "t5= ┘~WW~└"
- :begin
- cls&echo 方向控制为:w上s下a左d右f射击(z键退出)&echo.
- for /l %%a in (1,1,%num%) do (
- set "b="
- if defined mc (
- if "%%a" equ "%dd%" (
- set "b= ·"
- if "%dd%" equ "%num%" set "b= "∵'"
- if "%dd%" equ "1" set "b= ."¤'~"
- ) else (
- set "b="
- )
- )
- echo.%k%!b!
- )
- for /l %%a in (1,1,5) do echo %k%!t%%a!
- choice /n /c "wsadfz"%mc%
- if %errorlevel% equ 1 if %num% neq 0 set /a num-=1
- if %errorlevel% equ 2 if %num% neq 16 set /a num+=1"
- if %errorlevel% equ 3 if "%k:~1%" neq "" set "k=%k:~1%"
- if %errorlevel% equ 4 if "%k:~67%" equ "" set "k=%k% "
- if %errorlevel% equ 5 (
- if "!n!" neq "%num%" (
- set /a n+=1,dd=num-n+1
- set "mc= /d f /t 0"
- for /l %%a in (1,1,50) do echo>nul
- goto begin
- ) else (
- set /a n=0&set "mc="
- )
- )
- if %errorlevel% equ 6 goto :eof
- goto begin
复制代码
[ 本帖最后由 batman 于 2009-10-18 18:05 编辑 ]
作者: batman 时间: 2009-10-18 18:02
原帖由 canyuexiaolang 于 2009-10-18 11:41 发表
坦克不是螃蟹...要是头能拐弯就好了
1、头拐弯是很容易的事,只是我现在没法用字符画出横着的坦克(府视角度)。
2、本批是用来对choice.exe应用示例,特效不是重点,这我在顶楼就说明了的。
作者: feiyang3x 时间: 2009-10-18 18:09
下了论坛的chioce.exe并运行了,可还是提醒choice不是内部命令,高手指点
作者: batman 时间: 2009-10-18 22:43 标题: 再次更新爆炸特效
- @echo off&setlocal enabledelayedexpansion
- title 坦克&color 02
- for /l %%a in (1,1,30) do set "k=!k! "
- for /l %%a in (1,1,66) do set "cl=!cl! "
- set /a num=10
- set "t1= ‖"
- set "t2= ┐_‖_┌"
- set "t3=┋o nn o┋"
- set "t4=┋(∩)┋"
- set "t5= ┘~WW~└"
- :begin
- cls&echo 方向控制为:w上s下a左d右f射击(z键退出)&echo.
- for /l %%a in (1,1,%num%) do (
- set "b="
- if defined mc (
- if "%%a" equ "%dd%" (
- set "b= ·"
- if "%dd%" equ "%num%" (
- set "b= "∵'"
- )
- if "%dd%" equ "1" (
- set "b= "¤~."
- for /l %%b in (1,1,5) do (
- set /p=%k% ★<nul
- call :delay 100&set /p=%cl%%k%!b!<nul
- call :delay 100&set /p=%cl%<nul
- )
- echo.
- )
- ) else (
- set "b="
- )
- )
- echo.%k%!b!
- )
- for /l %%a in (1,1,5) do echo %k%!t%%a!
- choice /n /c "wsadfz"%mc%
- if %errorlevel% equ 1 if %num% neq 0 set /a num-=1
- if %errorlevel% equ 2 if %num% neq 16 set /a num+=1"
- if %errorlevel% equ 3 if "%k:~1%" neq "" set "k=%k:~1%"
- if %errorlevel% equ 4 if "%k:~67%" equ "" set "k=%k% "
- if %errorlevel% equ 5 (
- if "!n!" neq "%num%" (
- set /a n+=1,dd=num-n+1
- set "mc= /d f /t 0"
- call :delay 500&goto begin
- ) else (
- set /a n=0&set "mc="
- )
- )
- if %errorlevel% equ 6 goto :eof
- goto begin
- :delay
- for /l %%c in (1,1,%1) do echo>nul
复制代码
作者: zqz0012005 时间: 2009-10-19 00:00
尽量不要用debug的好,我在很多电脑上遇到使用16位程序时系统蓝屏的情况。
可能很多显卡驱动根本就不再支持16位模式。
作者: batman 时间: 2009-10-19 00:17 标题: 更新至可转向的坦克(射击暂无)
- @echo off&setlocal enabledelayedexpansion
- title 坦克&color 02
- for /l %%a in (1,1,35) do set "k=!k! "
- set /a num=10
- set "t1-1= ‖"
- set "t1-2= ┐_‖_┌"
- set "t1-3=┋o nn o┋"
- set "t1-4=┋(∩)┋"
- set "t1-5= ┘~WW~└"
- set "t2-1= ┐_MM_┌"
- set "t2-2=┋(∪)┋"
- set "t2-3=┋o uu o┋"
- set "t2-4= ┘~‖~└"
- set "t2-5= ‖"
- set "t3-1= ┌ …… ┐"
- set "t3-2= │o ~│"
- set "t3-3======E(G 〕"
- set "t3-4= │o ~│"
- set "t3-5= └ …… ┘"
- set "t4-1=┌ …… ┐"
- set "t4-2= │~ o│"
- set "t4-3=〔 D)B====="
- set "t4-4= │~ o│"
- set "t4-5=└ …… ┘"
- :begin
- cls&echo 方向控制为:w上s下a左d右(z键退出)&echo.
- for /l %%a in (1,1,%num%) do echo.
- if not defined n set /a n=1
- for /l %%a in (1,1,5) do echo %k%!t%n%-%%a!
- choice /n /c "wsadz"
- if %errorlevel% equ 5 goto :eof
- if %errorlevel% neq %n% set /a num_%n%=0
- set /a num_%errorlevel%+=1,n=%errorlevel%
- if !num_%errorlevel%! neq 1 (
- if %errorlevel% equ 1 if %num% neq 0 set /a num-=1
- if %errorlevel% equ 2 if %num% neq 17 set /a num+=1"
- if %errorlevel% equ 3 if "%k:~1%" neq "" set "k=%k:~1%"
- if %errorlevel% equ 4 if "%k:~66%" equ "" set "k=%k% "
- )
- goto begin
复制代码
[ 本帖最后由 batman 于 2009-10-19 00:21 编辑 ]
作者: Seter 时间: 2009-10-22 21:48
原帖由 feiyang3x 于 2009-10-18 18:09 发表
下了论坛的chioce.exe并运行了,可还是提醒choice不是内部命令,高手指点
是choice.exe不是chioce.exe,,,而且运行没用的...要放到c:\windows\system32下,顶楼不是说了嘛
作者: batman 时间: 2009-10-27 16:08 标题: 更新至能转向和射击(有射击特效)的坦克
本来还可加入音效,考虑太复杂了,暂不加了,在运行前请先确定系统中有没有choice.exe:- @echo off&setlocal enabledelayedexpansion
- title 坦克&color 02
- for /l %%a in (1,1,35) do set "k=!k! "
- for /l %%a in (1,1,66) do set "kk=!kk! "
- set /a num_w=10,num_s=16,n=1,w=-1,s=-1,a=1,d=-1,w_num=0,s_num=0
- set "t1-1= ‖"
- set "t1-2= ┐_‖_┌"
- set "t1-3=┋o nn o┋"
- set "t1-4=┋(∩)┋"
- set "t1-5= ┘~WW~└"
- set "t2-1= ┐_MM_┌"
- set "t2-2=┋(∪)┋"
- set "t2-3=┋o uu o┋"
- set "t2-4= ┘~‖~└"
- set "t2-5= ‖"
- set "t3-1= ┌ …… ┐"
- set "t3-2= │o ~│"
- set "t3-3======E(G 〕"
- set "t3-4= │o ~│"
- set "t3-5= └ …… ┘"
- set "t4-1=┌ …… ┐"
- set "t4-2= │~ o│"
- set "t4-3=〔 D)B====="
- set "t4-4= │~ o│"
- set "t4-5=└ …… ┘"
- :begin
- cd.>%~n0.tem
- echo 方向控制为:w上s下a左d右f射击^(z键退出^)>>%~n0.tem&echo.>>%~n0.tem
- for /l %%a in (1,1,%num_w%) do (
- set "w_f="
- if defined dt if %%a equ %w_num% (
- set "w_f= ·"
- if %%a equ %num_w% set "w_f= "∵'"
- if %%a equ 1 set "w_f= ¤"
- )
- echo.%k%!w_f!>>%~n0.tem
- )
- for /l %%a in (1,1,5) do (
- set "ok="
- if %%a equ 3 if defined dt if %n% equ 3 (
- set "a_f=·"
- if "%k_a%" equ "" set "a_f=∷"
- if "!K:~%a%!" equ "" set "a_f=¤"
- echo !k:~%a%!!a_f!%k_a%!t%n%-%%a!>>%~n0.tem&set "ok=a"
- )
- if %%a equ 3 if defined dt if %n% equ 4 (
- set "s_f=·"
- if "%k_d%" equ "" set "s_f=∷"
- if "%k%%k_d%" equ "%kk:~1%" set "s_f=¤"
- echo %k%!t%n%-%%a!%k_d%!s_f!>>%~n0.tem&set "ok=a"
- )
- if not defined ok echo %k%!t%n%-%%a!>>%~n0.tem
- )
- for /l %%a in (%num_s%,1,21) do (
- set "s_f="
- if defined dt if %%a equ %s_num% (
- set "s_f= ·"
- if %%a equ %num_s% set "s_f= "∵'"
- if %%a equ 21 set "s_f= ¤"
- )
- echo.%k%!s_f!>>%~n0.tem
- )
- cls&type %~n0.tem
- choice /n /c "wsadfz"%dt%
- if %errorlevel% equ 6 del /q %~n0.tem>nul 2>nul&goto :eof
- set /a num_e=%errorlevel%
- if %num_e% equ 5 (
- if %n% equ 1 (
- if %w% lss %num_w% (
- set "dt= /d "f" /t 0"
- set /a w+=1,w_num=num_w-w
- for /l %%a in (1,1,200) do echo>nul
-
- ) else (
- set /a w=-1,w_num=0&set "dt="
- )
- )
- if %n% equ 2 (
- if %s_num% lss 21 (
- set "dt= /d "f" /t 0"
- set /a s+=1,s_num=num_s+s
- for /l %%a in (1,1,200) do echo>nul
- ) else (
- set /a s=-1,s_num=0&set "dt="
- )
- )
- if %n% equ 3 (
- if "!k_a!" neq "%k:~2%" (
- set "dt= /d "f" /t 0"
- set /a a+=1&set "k_a="
- for /l %%a in (3,1,!a!) do set "k_a=!k_a! "
- ) else (
- set /a a=1&set "dt="&set "k_a="
- )
- )
- if %n% equ 4 (
- if "!k_d!%k%" neq "%kk:~1%" (
- set "dt= /d "f" /t 0"
- set /a d+=1&set "k_d="
- for /l %%a in (1,1,!d!) do set "k_d=!k_d! "
- ) else (
- set /a d=-1&set "dt="&set "k_d="
- )
- )
- )
- if %num_e% neq %n% set /a _%n%=0
- if %num_e% lss 5 set /a _%num_e%+=1,n=%num_e%
- if !num_%num_e%! neq 1 (
- if %num_e% equ 1 if %num_w% neq 0 set /a num_w-=1,num_s-=1
- if %num_e% equ 2 if %num_w% neq 16 set /a num_w+=1,num_s+=1
- if %num_e% equ 3 if "%k:~1%" neq "" set "k=%k:~1%"
- if %num_e% equ 4 if "%k:~64%" equ "" set "k=%k% "
- )
- goto begin
复制代码
作者: qaz123654 时间: 2009-10-27 17:25
cd.>%~n0.tem
看来是不支持文件名有空格了
作者: acoolbug 时间: 2010-4-21 10:46
强人啊。。。
太牛了。。
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |