loading

How to make a BATCH FILE DRAGON GAME

I HAVE AN UPDATED VERSION ON THIS GAME:

https://www.instructables.com/id/Batch-File-Dragon-...

  1. Press Start
  2. Type in notepad
  3. In notepad Copy and Paste the code below:
  4. In the top right of notepad click File
  5. Then click Save As
  6. IMPORTANT: Name the file DragonKill.bat
  7. Then Click the drop down menu below that says Text Document
  8. Change it to All Files
  9. Click save
  10. Then go to your windows explorer (the file folder icon) then open up the game!
  11. ENJOY =)
@echo off

:menu
color 0a
cls
echo DRAGON KILL
echo Choose the number:
echo 1. Start game
echo 2. Exit
set /p menu=
if '%menu%'=='1' (
goto sets
)
if '%menu%'=='2' (
exit
)else goto menu
:sets
cls
set /a money=1000
set /a health=1000
set /a potions=0
set /a damage=2
set /a dd=5
set /a dh=25
set /a moneygain=50
set /a levels=0
set /a new=%dh%+5
:start
cls
echo Money:%money%
echo Health:%health%
echo Number of healing potions:%potions%
echo Choose the number:
echo 1. Venture onward to the dragon
echo 2. Go to Store
echo 3. Go to Title screen
echo 4. Drink heal potion
set /p choose=
if '%choose%'=='1' (
cls
echo DO NOT HOLD THE ENTER KEY
pause
goto fight
)
if '%choose%'=='2' (
goto store
)
if '%choose%'=='3' (
goto menu
)
if '%choose%'=='4' (
goto nextx
)else goto start
:fight
cls
echo Health:%health%
echo Dragon's Health:%new%
echo You have encountered a dragon
pause
cls
echo Press enter to hit the dragon
set /p hit=
set /a new=%new%-%damage%
if %new% LSS 1 (
goto defeat
)
cls
echo Health:%health%
echo Dragon's Health:%new%
echo You have hit the dragon
echo The dragon lost %damage% health
pause
cls
echo The dragon has hit you!
set /a health=%health%-%dd%
if %health% LSS 1 (
goto defeated
)
pause
cls
goto fight
:defeat
cls
set /a dh=%dh%+20
set /a new=%dh%
set /a money=%money%+15
set /a levels=%levels%+1
echo You defeated the dragon and earned $15.
echo Congratz
pause
goto start
:defeated
cls
echo Sorry You died!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo RIP
echo You have killed %levels% dragon
pause
goto menu
:store
cls
echo Money:%money%
echo Welcome to the store!
echo Choose:
echo 1.Sword Upgrade	$700
echo 2.Heal Potion	$30
echo 3.Leave Store
set /p again=
if %again%==1 (
goto buysword
)
if %again%==2 (
goto buyheal
)
if %again%==3 (
goto start
)else goto store</p><p>:buysword
cls
set /a money=%money%-700
if %money% LSS 0 (
echo You cant buy that!
set /a money=%money%+700
pause
goto store
)else (
set /a damage=%damage%+4
echo You have upgraded your sword
pause
goto store
)
:buyheal
cls
set /a money=%money%-30
if %money% LSS 0 (
echo You cant buy that!
set /a money=%money%+30
pause
goto store
)else (
set /a potions=%potions%+1
echo You have bought one heal potion
pause
goto store
)
:nextx
cls
if %potions%==0 (
echo Sorry. You dont have any potions.
pause
goto start
)else (
set /a health=%health%+15
set /a potions=%potions%-1
echo You have used one potion
pause
goto start
)
<p>Well, hopefully you made an update where your program doesn't crash after leaving the store because finding and fixing bugs in someone else's program is such a drag</p>
<p>I have made an updated version, where you are allowed to hold the enter key:</p><p>@echo off</p><p>:menu</p><p>color 0a</p><p>cls</p><p>echo DRAGON KILL</p><p>echo Choose the number:</p><p>echo 1. Start game</p><p>echo 2. Exit</p><p>echo Made by CodeSmartz and I_boom5245</p><p>set /p menu=</p><p>if '%menu%'=='1' (</p><p>goto sets</p><p>)</p><p>if '%menu%'=='2' (</p><p>exit</p><p>)else goto menu</p><p>:sets</p><p>cls</p><p>set /a money=1000</p><p>set /a health=1000</p><p>set /a potions=0</p><p>set /a damage=2</p><p>set /a dd=5</p><p>set /a dh=25</p><p>set /a moneygain=50</p><p>set /a levels=0</p><p>set /a new=%dh%+5</p><p>:start</p><p>cls</p><p>echo Money:%money%</p><p>echo Health:%health%</p><p>echo Number of healing potions:%potions%</p><p>echo Choose the number:</p><p>echo 1. Venture onward to the dragon</p><p>echo 2. Go to Store</p><p>echo 3. Go to Title screen</p><p>echo 4. Drink heal potion</p><p>set /p choose=</p><p>if '%choose%'=='1' (</p><p>goto fight</p><p>)</p><p>if '%choose%'=='2' (</p><p>goto store</p><p>)</p><p>if '%choose%'=='3' (</p><p>goto menu</p><p>)</p><p>if '%choose%'=='4' (</p><p>goto nextx</p><p>)else goto start</p><p>:fight</p><p>cls</p><p>echo Health:%health%</p><p>echo Dragon's Health:%new%</p><p>echo You have encountered a dragon</p><p>pause</p><p>cls</p><p>echo Press enter to hit the dragon</p><p>set /p hit=</p><p>set /a new=%new%-%damage%</p><p>if %new% LSS 1 (</p><p>goto defeat</p><p>)</p><p>cls</p><p>echo Health:%health%</p><p>echo Dragon's Health:%new%</p><p>echo You have hit the dragon</p><p>echo The dragon lost %damage% health</p><p>pause</p><p>cls</p><p>echo The dragon has hit you!</p><p>set /a health=%health%-%dd%</p><p>if %health% LSS 1 (</p><p>goto defeated</p><p>)</p><p>pause</p><p>cls</p><p>goto fight</p><p>:defeat</p><p>cls</p><p>set /a dh=%dh%+20</p><p>set /a new=%dh%</p><p>set /a money=%money%+50</p><p>set /a levels=%levels%+1</p><p>echo You defeated the dragon and earned $50.</p><p>echo Congratz</p><p>ping localhost -n 5 &gt;nul</p><p>pause</p><p>goto start</p><p>:defeated</p><p>cls</p><p>echo Sorry You died!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</p><p>echo RIP</p><p>echo You have killed %levels% dragons</p><p>ping localhost -n 5 &gt;nul</p><p>pause</p><p>goto menu</p><p>:store</p><p>cls</p><p>echo Money:%money%</p><p>echo Welcome to the store!</p><p>echo Choose:</p><p>echo 1.Sword Upgrade$700</p><p>echo 2.Heal Potion$30</p><p>echo 3.Leave Store</p><p>set /p again=</p><p>if %again%==1 (</p><p>goto buysword</p><p>)</p><p>if %again%==2 (</p><p>goto buyheal</p><p>)</p><p>if %again%==3 (</p><p>goto start</p><p>)else goto store</p><p>:buysword</p><p>cls</p><p>set /a money=%money%-700</p><p>if %money% LSS 0 (</p><p>echo You cant buy that!</p><p>set /a money=%money%+700</p><p>pause</p><p>goto store</p><p>)else (</p><p>set /a damage=%damage%+4</p><p>echo You have upgraded your sword</p><p>pause</p><p>goto store</p><p>)</p><p>:buyheal</p><p>cls</p><p>set /a money=%money%-30</p><p>if %money% LSS 0 (</p><p>echo You cant buy that!</p><p>set /a money=%money%+30</p><p>pause</p><p>goto store</p><p>)else (</p><p>set /a potions=%potions%+1</p><p>echo You have bought one heal potion</p><p>pause</p><p>goto store</p><p>)</p><p>:nextx</p><p>cls</p><p>if %potions%==0 (</p><p>echo Sorry. You dont have any potions.</p><p>pause</p><p>goto start</p><p>)else (</p><p>set /a health=%health%+15</p><p>set /a potions=%potions%-1</p><p>echo You have used one potion</p><p>pause</p><p>goto start</p><p>)</p>

About This Instructable

2,460views

4favorites

More by CodeSmartz:Batch File Dragon Game Updated How to make a CMD color page Batch File Dragon Game 
Add instructable to: