Mar 23, 2017 01:53 PM
(This post was last modified: Mar 29, 2017 07:19 AM by ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™.)
Hello all ^-^
IF YOU WANT TO FOLLOW ALONG
Spoiler (Click to View)
CODE from video:
Spoiler (Click to View)
:canvas, :showCanvas, :updateCanvas
Spoiler (Click to View)
:circle
Spoiler (Click to View)
:Cursorpos
Spoiler (Click to View)
IF YOU WANT TO FOLLOW ALONG
Spoiler (Click to View)
Code
@echo off & setlocal enableDelayedExpansion
call :canvas 50 40
:main
call :showCanvas
call :updateCanvas
goto :main
:canvas
set /a "width=%~1 - 1", "height=%~2 - 1", "conWidth=width + 5", "conHeight=height + 6", "_=0"
for /l %%a in (-2,1,%width%) do set "outerBuffer=!outerBuffer!#"
for /l %%a in (0,1,%width%) do set "widthBuffer=!widthBuffer! "
call :updateCanvas
call :cursorpos
if exist "%temp%\cursorpos.exe" ( set "cls="%temp%\cursorpos.exe" 0 1" ) else ( set "cls=cls" )
mode con: cols=%conWidth% lines=%conHeight%
goto :eof
:updateCanvas
for /l %%a in (0,1,%height%) do set "_[%%a]=%widthBuffer%"
goto :eof
:showCanvas
%cls%
echo= %outerBuffer%
for /l %%a in (0,1,%height%) do echo= #!_[%%a]!#
echo= %outerBuffer%
if "%~1" equ "/u" for /l %%a in (0,1,%height%) do set "_[%%a]=%widthBuffer%"
goto :eof
goto :eof
:circle x y r
set /a "___rr=%~3"
for /l %%y in (-%___rr%,1,%___rr%) do for /l %%x in (-%___rr%,1,%___rr%) do (
set /a "t=-___rr - 1", "S=(%%x * %%x) + (%%y * %%y) - (___rr * ___rr) - t - 1"
if !S! geq !t! if !S! leq 1 (
set /a "_x=%%x + %~1", "_y=%%y + %~2"
set /a "_x2=_x + 1"
call set "_[!_y!]=%%_[!_y!]:~0,!_x!%%%~4%%_[!_y!]:~!_x2!%%"
)
)
for %%a in (t S _x _y _x2 ___rr) do set "%%a="
goto :eofCODE from video:
Spoiler (Click to View)
Code
@echo off & setlocal enableDelayedExpansion
call :canvas 50 40
set "x=25"
set "y=-1"
set "radius=3"
set "speed=2"
set "char=."
set "gravity=1"
:main
set /a "accY+=gravity + speed"
set /a "velY+=accY"
set /a "y+=velY"
set /a "accY*=0"
if !y! geq %height% set /a "y=height - radius", "velY*=-1"
call :circle x y radius %char%
call :showCanvas
call :updateCanvas
goto :main
:canvas
set /a "width=%~1 - 1", "height=%~2 - 1", "conWidth=width + 5", "conHeight=height + 6", "_=0"
for /l %%a in (-2,1,%width%) do set "outerBuffer=!outerBuffer!#"
for /l %%a in (0,1,%width%) do set "widthBuffer=!widthBuffer! "
call :updateCanvas
call :cursorpos
if exist "%temp%\cursorpos.exe" ( set "cls="%temp%\cursorpos.exe" 0 1" ) else ( set "cls=cls" )
mode con: cols=%conWidth% lines=%conHeight%
goto :eof
:updateCanvas
for /l %%a in (0,1,%height%) do set "_[%%a]=%widthBuffer%"
goto :eof
:showCanvas
%cls%
echo= %outerBuffer%
for /l %%a in (0,1,%height%) do echo= #!_[%%a]!#
echo= %outerBuffer%
if "%~1" equ "/u" for /l %%a in (0,1,%height%) do set "_[%%a]=%widthBuffer%"
goto :eof
goto :eof
:circle x y r
set /a "___rr=%~3"
for /l %%y in (-%___rr%,1,%___rr%) do for /l %%x in (-%___rr%,1,%___rr%) do (
set /a "t=-___rr - 1", "S=(%%x * %%x) + (%%y * %%y) - (___rr * ___rr) - t - 1"
if !S! geq !t! if !S! leq 1 (
set /a "_x=%%x + %~1", "_y=%%y + %~2"
set /a "_x2=_x + 1"
call set "_[!_y!]=%%_[!_y!]:~0,!_x!%%%~4%%_[!_y!]:~!_x2!%%"
)
)
for %%a in (t S _x _y _x2 ___rr) do set "%%a="
goto :eof:canvas, :showCanvas, :updateCanvas
Spoiler (Click to View)
:circle
Spoiler (Click to View)
:Cursorpos
Spoiler (Click to View)



Bitcoin: