I am making another batch video game that looks like a maze, and I have my controls set up, but I was wondering if there is a way to turn on a “collision” event in the script so that instead of outlining all the possible positions where the character might be in the game, I could just make it so that if there was nothing in front of the character, I would move forward, but if something was in front of him, I would replay this frame (stay in the same position). There is a link to my current game script at the bottom of this post. Say, if I had a simplified map that looked something like this:
@echo off
title level 1
cls
:MAIN
echo °°°°°°°ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»°°°°°°°°°°°°°°
echo °°°°°°°º º º X º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º Û º º º°°°°°°°°°°°°°°
echo °°°°°°°ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ°°°°°°°°°°°°°°
goto MAIN
My current control will be:
choice /c awsd /n
IF %errorlevel%==2 goto a2
IF %errorlevel%==1 goto a1
IF %errorlevel%==4 goto a1
IF %errorlevel%==3 goto a1
goto a1
, ( ) , . ( , ), , - :
@echo off
title level 1
cls
:MAIN
echo °°°°°°°ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»°°°°°°°°°°°°°°
echo °°°°°°°º Û º º X º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º°°°°°°°°°°°°°°
echo °°°°°°°ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ°°°°°°°°°°°°°°
:a1
choice /c awsd /n
IF %errorlevel%==2 goto a2check
IF %errorlevel%==1 goto a3
IF %errorlevel%==4 goto a3
IF %errorlevel%==3 goto a3
goto a1
:a2check
set /p collision=<collision_check.bat
IF %collision%==yes goto collision_confirm
IF %collision%==no goto a2
goto MAIN
:collision_confirm
cls
goto MAIN
:a3
cls
:: somehow edit the map so that the character "Û" moves to the position
:: specified by the user in the choice command section.
:: so the new position would be:
echo °°°°°°°ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»°°°°°°°°°°°°°°
echo °°°°°°°º Û º º X º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º º º°°°°°°°°°°°°°°
echo °°°°°°°º º º º°°°°°°°°°°°°°°
echo °°°°°°°ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ°°°°°°°°°°°°°°
goto a3
collision_check.bat, , , , . , , !