gpt4 book ai didi

windows - 批量游戏中的碰撞检测无法正常工作

转载 作者:可可西里 更新时间:2023-11-01 11:49:15 26 4
gpt4 key购买 nike

所以我在搞乱批处理,并制作了这个脚本:

@echo off
setlocal enabledelayedexpansion
set /a "start=33"
set "sc1=°"
set "sc2=°"
set "sc3=°"
set "sc4=°"
set "sc5=°"
set "sc6= "
set "sc7= "
set "sc8= "
set "sc9= "
set "sc10= "
set "sc11= "
set "sc12= "
set "sc13= "
set "sc14= "
set "sc15= "
set "sc16= "
set "sc17= "
set "sc18= "
set "sc19= "
set "sc20= "
set "sc21= "
set "sc22= "
set "sc23=°"
set "sc24= "
set "sc25= "
set "sc26= "
set "sc27= "
set "sc28= "
set "sc29= "
set "sc30= "
set "sc31= "
set "sc32= "
set "sc33=X"
set "sc34= "
set "sc35= "
set "sc36= "
set "sc37= "
set "sc38= "
set "sc39= "
set "sc40= "
set "sc41= "
set "sc42= "
set "sc43= "
set "sc44= "
set "sc45= "
set "sc46= "
set "sc47= "
set "sc48= "
set "sc49= "
set "sc50= "
set "sc51= "
set "sc52= "
set "sc53= "
set "sc54= "
set "sc55= "

:display
cls
echo. !sc1!!sc2!!sc3!!sc4!!sc5!
echo. !sc6!!sc7!!sc8!!sc9!!sc10!
echo. !sc11!!sc12!!sc13!!sc14!!sc15!
echo. !sc16!!sc17!!sc18!!sc19!!sc20!
echo. !sc21!!sc22!!sc23!!sc24!!sc25!
echo. !sc26!!sc27!!sc28!!sc29!!sc30!
echo. !sc31!!sc32!!sc33!!sc34!!sc35!
echo. !sc36!!sc37!!sc38!!sc39!!sc40!
echo. !sc41!!sc42!!sc43!!sc44!!sc45!
echo. !sc46!!sc47!!sc48!!sc49!!sc50!
echo. !sc51!!sc52!!sc53!!sc54!!sc55!
choice /c wasd
if !ERRORLEVEL!==1 (
set /a "x=5"
set "op=-"
)
if !ERRORLEVEL!==2 (
set /a "x=1"
set "op=-"
)
if !ERRORLEVEL!==3 (
set /a "x=5"
set "op=+"
)
if !ERRORLEVEL!==4 (
set /a "x=1"
set "op=+"
)
call :detect

if !m! EQU 1 (
goto :display
)

set /a "newstart=!start!!op!!x!"
set "sc!newstart!=X"
set "sc!start!= "
set /a "start=!newstart!"
goto :display


:detect
set /a "detect=!start!!op!!x!"
if !sc%detect%!==° (
set /a "m=1"
)
exit /b

这只是一个批量游戏的简单原型(prototype)。您可以使用 wasd 向各个方向移动。我遇到的唯一问题是,当您将按钮靠在墙上时,您会永久卡住。我该如何解决这个问题?

最佳答案

您的检测工作正常。你的问题是你在检测到碰撞后永远不会清除“m”值,因此你会被卡住。最简单的解决方法是在 :detect 例程开始时将 m 简单地初始化为 0。

关于windows - 批量游戏中的碰撞检测无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34428884/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com