Posted February 07, 2025 by _Mays_Studio_
#Eingine
Пока пишем в bat файле
Вот код:
at
@echo off
setlocal enabledelayedexpansion
color 20
set y=1
set x=1
:getkey
cls
call :updateScreen
CHOICE /C WASD /N /M "Move [W,A,S,D]?"
set key=%errorlevel%
if %key%==1 set /a y-=1
if %key%==2 set /a x-=1
if %key%==3 set /a y+=1
if %key%==4 set /a x+=1
:: Ensure the player does not move out of bounds
if %y% lss 1 set y=1
if %y% gtr 5 set y=5
if %x% lss 1 set x=1
if %x% gtr 10 set x=10
goto :getkey
:updateScreen
for /L %%i in (1,1,5) do (
set line=
for /L %%j in (1,1,11) do (
if %%i==%y% if %%j==%x% (
set "part=# "
) else (
set "part=. "
)
set line=!line!!part!
)
echo !line!
)
echo %y% %x%
exit /b