Introduction: Batch File Dragon Game
How to make a BATCH FILE DRAGON GAME
I HAVE AN UPDATED VERSION ON THIS GAME:
https://www.instructables.com/id/Batch-File-Dragon-...
- Press Start
- Type in notepad
- In notepad Copy and Paste the code below:
- In the top right of notepad click File
- Then click Save As
- IMPORTANT: Name the file DragonKill.bat
- Then Click the drop down menu below that says Text Document
- Change it to All Files
- Click save
- Then go to your windows explorer (the file folder icon) then open up the game!
- 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 )
10 Comments
1 year ago
I'm making a game and I don't know whats wrong but it keeps refreshing
@echo off
attrib +H statssave.meow
:main
color 09
cls
title Hero Streak
echo HERO STREAK
echo Choose a number
echo 1. New Game
echo 2. Quit
echo 3. How to Play
echo 4. Login
echo (easter egg hint: 5 minute crafts)
set p/ main=
if '%main%'=='1' (
goto sets
)
if '%main%'=='2' (
goto laptop
)
if '%main%'=='3' (
goto howto
)
if '%main%'=='4' (
goto login
)else goto main
4 years ago
OKAY! So this now has armor, random number values, usable levels, and SAVE AND LOAD FEATURES!!!
@echo off
:menu
color 40
cls
echo Dragon Slayer!!!
echo Choose the number:
echo 1. Start game
echo 2. Exit
choice /c:12 /n > nul
if errorlevel 2 goto exit
if errorlevel 1 goto sets
:sets
cls
set /a money=1500
set /a health=1000
set /a potions=1
set /a damage=5
set /a armor=5
set /a dd=5+%level%+%random%%% 5 +15
set /a dh=25
set /a moneygain=50
set /a levels=0
set /a new=%dh%+5
goto start
:start
cls
echo Money:%money%
echo Health:%health%
echo Damage:%damage%
echo Armor:%armor%
echo Level:%levels%
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
echo 5. Save
Echo 6. Load
choice /c:123456 /n > nul
if errorlevel 6 goto load
if errorlevel 5 goto save
if errorlevel 4 goto nextx
if errorlevel 3 goto menu
if errorlevel 2 goto store
if errorlevel 1 goto fight
: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%/%armor%
if %health% LSS 1 (
goto defeated
)
pause
cls
goto fight
:defeat
cls
set /a dh=%dh%+%random%%% 5 +100
set /a new=%dh%
set /a money=%money%+%level%+%random%%% 100 +160
set /a levels=%levels%+1
echo You defeated the dragon and earned gold.
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$500
echo 2.Armor Upgrade$1500
echo 3.Heal Potion$10
echo 4.Leave Store
choice /c:1234 /n > nul
if errorlevel 4 goto start
if errorlevel 3 goto buyheal
if errorlevel 2 goto buyarmor
if errorlevel 1 goto buysword
:buysword
cls
set /a money=%money%-500
if %money% LSS 0 (
echo You cant buy that!
set /a money=%money%+500
pause
goto store
)else (
set /a damage=%damage%+10
echo You have upgraded your sword
pause
goto store
)
:buyarmor
cls
set /a money=%money%-1500
if %money% LSS 0 (
echo You cant buy that!
set /a money=%money%+1500
pause
goto store
)else (
set /a armor=%armor%+10
echo You have upgraded your armor
pause
goto store
)
:buyheal
cls
set /a money=%money%-10
if %money% LSS 0 (
echo You cant buy that!
set /a money=%money%+10
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%%+30 +10
set /a potions=%potions%-1
echo You have used one potion and gained 30 health
pause
goto start
)
:save
cls
(
echo Money:%money%
echo Health:%health%
echo Damage:%damage%
echo Armor:%armor%
echo Level:%levels%
echo DragonHealth:%dh%
echo Number of healing potions:%potions%
) > savegame.sav
echo Press enter to continue
pause
goto start
:load
cls
< savegame.sav (
set /p Money=%money%
set /p Health=%health%
set /p Damage=%damage%
set /p Armor=%money%
set /p Levels=%levels%
set /p DragonHealth=%dh%
)
echo Press enter to continue
pause
goto start
Reply 2 years ago
im making a game launcher and used this save code in my game thats all i used im wondering if its ok to publish my game to the ublic with your save and load script in it. I put you in the credits setio as well stating this. "Save And Load Concept: Brotherscool123 on instructables.com"
3 years ago
Hi I am Quarkii,
I made a better english version, but also a German one...
The first one is the english version and the second one is german:
English:
@echo off
title DRAGON KILL -Made by Quarkii-
color a
:MainMenu
cls
echo.
echo DRAGON KILL
echo --------------
echo CHOOSE
echo.
echo [1] Start the game
echo.
echo [2] Change the color
echo.
echo [3] Leave
echo.
echo.
set /p menu= Choose:
if /i %menu%== 1 goto sets
if /i %menu%== 2 goto colorchoose1
if /i %menu%== 3 exit
)else goto menu
:sets
cls
set /a money=1000
set /a health=500
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
goto start
:start
cls
echo.
echo ______________________________
echo Gold:%money% /
echo Health:%health% /
echo Healpotion:%potions% /
echo __________________________/
echo.
echo.
echo Choose!
echo.
echo [1] Fight the dragon
echo.
echo [2] Go to the shop
echo.
echo [3] Drink a healpotion
echo.
echo [4] Go to the titlescreen
echo.
echo.
set /p menu=Choose:
if /i %menu%== 1 goto fight
cls
echo.
pause
if /i %menu%== 2 goto store
if /i %menu%== 3 goto MainMenu
if /i %menu%== 4 goto nextx
:fight
cls
echo -----------------------
echo Your health: %health%
echo Dragons health: %new%
echo -----------------------
echo.
echo You encountered the Dragon
echo.
echo.
pause
cls
echo Press Enter to attack the dragon!
set /p hit=
set /a new=%new%-%damage%
if %new% LSS 1 (
goto defeat
)
cls
echo --------------------
echo Deine Leben:%health%
echo Leben vom Drachen:%new%
echo --------------------
echo.
echo You damaged the dragon for %damage%
echo.
echo.
pause
cls
echo The dragon attacked 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%+50
set /a levels=%levels%+1
echo.
echo You defeated the Dragon and earned
echo Well played!
echo.
echo.
pause
goto start
:defeated
cls
echo DIED
echo RIP
echo You defeated the dragon %levels% times
pause
goto menu
:store
cls
echo Gold:%money%
echo Welcome to the Shop!
echo.
echo Choose!
echo.
echo [1] Upgrade the sword 700 Gold
echo [2] Buy a healpotion 30 Gold
echo.
echo [3] Leave the shop
echo.
echo.
set /p menu=Choose:
if %menu%==1 goto buysword
if %menu%==2 goto buyheal
if %menu%==3 goto start
:buysword
cls
set /a money=%money%-700
if %money% LSS 0 (
echo.
echo You cant buy that!
echo.
set /a money=%money%+700
pause
goto store
)else (
set /a damage=%damage%+4
echo.
echo You improved your sword! (:
echo.
echo.
echo ..............................
echo ............+*+...............
echo ..........:******-............
echo ........-***+::+***...........
echo .........-+::::::+............
echo ........-***::::***...........
echo ..........+::::::*-...........
echo ........-***::::+**...........
echo .........-*:::::+*+...........
echo .........:*+::+::*+...........
echo .........-**:++:+**-..........
echo .........-*+:::::*:...........
echo .........:=*++++***:..........
echo ..........:+:::::+:...........
echo .........+==+++++*=+..........
echo ..........-+::+::++...........
echo .........-==+++++*=:..........
echo ...-=-.=+.+#++++:=@::@#-=@*...
echo ..=@@##@@##@@#*=@@@==##=#@@@=.
echo .:@@@##@@#=###=#@#==#@@#@@@*..
echo ...:@+.*@@@#@@#@@@#@@@:..+....
echo .........*:.-@###-.-:.........
echo ...........-@W@WWW:...........
echo .............#@@@-............
echo ...........-@W@@WW+...........
echo ............-#@@@#-...........
echo ...........#@@@#@@@#-.........
echo ..........-@@@##@@@=..........
echo ............-@@@@#-...........
echo ..............-=-.............
echo.
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 bought a healpotion! (:
echo.
echo ......................................
echo ......................................
echo ............-****========-............
echo ............-****========-............
echo ........-----::::::::::::----.........
echo ........-----:::::::::###----.........
echo ........-----****====####::::-........
echo ........-----****====####::::-........
echo .............:+::----++++-............
echo .............#::-...-:::#-............
echo .............#::-...-:::#-............
echo .............#::-...-:::#-............
echo .........--##----....---##---.........
echo ........-##--............##::-........
echo ........:+++:...-::::+++++++*:---.....
echo .....---*====----=#######====+:::-....
echo ....-:::+****::::=#######====*+++:---.
echo ----+###+---:############====####*:::-
echo ----+###+---:############====####*:::-
echo -:::+###+---:############====####*:::-
echo -:::+###+---:############====####*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::::::=####=======*::::=###+:::::::-
echo -:::::::=####=======*::::=###+:::::::-
echo ........-::::::::::::::::::::-........
echo ........-::::::::::::::::::::-........
echo ......................................
pause
goto store
)
:nextx
cls
if %potions%==0 (
echo Sorry, you have no more healpotion!
pause
goto start
)else (
set /a health=%health%+50
set /a potions=%potions%-1
echo.
echo You drunk a healpotion
echo.
echo.
echo ......................................
echo ......................................
echo ............-****========-............
echo ............-****========-............
echo ........-----::::::::::::----.........
echo ........-----:::::::::###----.........
echo ........-----****====####::::-........
echo ........-----****====####::::-........
echo .............:+::----++++-............
echo .............#::-...-:::#-............
echo .............#::-...-:::#-............
echo .............#::-...-:::#-............
echo .........--##----....---##---.........
echo ........-##--............##::-........
echo ........:+++:...-::::+++++++*:---.....
echo .....---*====----=#######====+:::-....
echo ....-:::+****::::=#######====*+++:---.
echo ----+###+---:############====####*:::-
echo ----+###+---:############====####*:::-
echo -:::+###+---:############====####*:::-
echo -:::+###+---:############====####*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::::::=####=======*::::=###+:::::::-
echo -:::::::=####=======*::::=###+:::::::-
echo ........-::::::::::::::::::::-........
echo ........-::::::::::::::::::::-........
echo ......................................
pause
goto start
)
:colorchoose1
cls
echo.
echo _______________________________
echo Choose your favorite color (: /
echo _____________________________/
echo.
echo Colors:
echo ------------
echo Green [G]
echo Dark green [DG]
echo Turquoise [T]
echo Blue [B]
echo Red [R]
echo Dark red [DR]
echo Purple [P]
echo Grey [Gr]
echo Yellow [Y]
echo White [W]
echo.
echo Finnished [F]
echo.
set /p auswahl= Auswahl:
if /i %auswahl%==G goto GR
if /i %auswahl%==DG goto DG
if /i %auswahl%==T goto TU
if /i %auswahl%==B goto BL
if /i %auswahl%==R goto RO
if /i %auswahl%==DR goto DR
if /i %auswahl%==P goto LI
if /i %auswahl%==GR goto GRA
if /i %auswahl%==Y goto GE
if /i %auswahl%==W goto WE
if /i %auswahl%==F goto MainMenu
:GR
color a
goto colorchoose1
:DG
color 2
goto colorchoose1
:TU
color 3
goto colorchoose1
:BL
color 9
goto colorchoose1
:RO
color c
goto colorchoose1
:DR
color 4
goto colorchoose1
:LI
color 5
goto colorchoose1
:GRA
color 8
goto colorchoose1
:GE
color e
goto colorchoose1
:WE
color f
goto colorchoose1
German:
@echo off
title DRAGON KILL -Made by Quarkii-
color a
:MainMenu
cls
echo.
echo DRAGON KILL
echo --------------
echo Entscheide!
echo.
echo [1] Spiel starten
echo.
echo [2] Farbe wechseln
echo.
echo [3] Verlassen
echo.
echo.
set /p menu= Auswahl:
if /i %menu%== 1 goto sets
if /i %menu%== 2 goto colorchoose1
if /i %menu%== 3 exit
)else goto menu
:sets
cls
set /a money=1000
set /a health=500
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
goto start
:start
cls
echo.
echo ______________________________
echo Gold:%money% /
echo Leben:%health% /
echo Heilungszauber:%potions% /
echo __________________________/
echo.
echo.
echo Entscheide!
echo.
echo [1] Wage den Weg zu Drachen
echo.
echo [2] Zum shop
echo.
echo [3] Heilungszauber trinken
echo.
echo [4] Zum Startbildschirm
echo.
echo.
set /p menu=Auswahl:
if /i %menu%== 1 goto fight
cls
echo.
pause
if /i %menu%== 2 goto store
if /i %menu%== 3 goto nextx
if /i %menu%== 4 goto MainMenu
:fight
cls
echo Deine Leben :%health%
echo Leben vom Drachen :%new%
echo Du bist dem Drachen begegnet
echo.
echo.
pause
cls
echo Tippe Enter um den Drachen anzugreifen!
set /p hit=
set /a new=%new%-%damage%
if %new% LSS 1 (
goto defeat
)
cls
echo Deine Leben:%health%
echo Leben vom Drachen:%new%
echo Du hast dem Drachen %damage% Schaden gemacht !
echo.
echo.
pause
cls
echo Der Drachen hat dich getroffen!
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%+50
set /a levels=%levels%+1
echo Du hast den Drachen besiegt und 50 Gold bekommen!
echo Sehr gut!
echo.
echo.
pause
goto start
:defeated
cls
echo Gestorben!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo RIP
echo Du hast den Drachen %levels% besiegt
pause
goto menu
:store
cls
echo Gold:%money%
echo Willkommen im Shop!
echo Suche aus:
echo.
echo [1] Schwert verbessern 700 Gold
echo [2] Heilungstrank 30 Gold
echo.
echo [3] Shop verlassen
echo.
echo.
set /p menu=Auswahl:
if %menu%==1 goto buysword
if %menu%==2 goto buyheal
if %menu%==3 goto start
:buysword
cls
set /a money=%money%-700
if %money% LSS 0 (
echo Du kannst das nicht kaufen!
set /a money=%money%+700
pause
goto store
)else (
set /a damage=%damage%+4
echo Du hast dein Schwert verbessert! (:
echo ..............................
echo ............+*+...............
echo ..........:******-............
echo ........-***+::+***...........
echo .........-+::::::+............
echo ........-***::::***...........
echo ..........+::::::*-...........
echo ........-***::::+**...........
echo .........-*:::::+*+...........
echo .........:*+::+::*+...........
echo .........-**:++:+**-..........
echo .........-*+:::::*:...........
echo .........:=*++++***:..........
echo ..........:+:::::+:...........
echo .........+==+++++*=+..........
echo ..........-+::+::++...........
echo .........-==+++++*=:..........
echo ...-=-.=+.+#++++:=@::@#-=@*...
echo ..=@@##@@##@@#*=@@@==##=#@@@=.
echo .:@@@##@@#=###=#@#==#@@#@@@*..
echo ...:@+.*@@@#@@#@@@#@@@:..+....
echo .........*:.-@###-.-:.........
echo ...........-@W@WWW:...........
echo .............#@@@-............
echo ...........-@W@@WW+...........
echo ............-#@@@#-...........
echo ...........#@@@#@@@#-.........
echo ..........-@@@##@@@=..........
echo ............-@@@@#-...........
echo ..............-=-.............
echo.
pause
goto store
)
:buyheal
cls
set /a money=%money%-30
if %money% LSS 0 (
echo Du kannst das nicht Kaufen!
set /a money=%money%+30
pause
goto store
)else (
set /a potions=%potions%+1
echo Du hast einen Heilungstrank gekauft! (:
echo.
echo ......................................
echo ......................................
echo ............-****========-............
echo ............-****========-............
echo ........-----::::::::::::----.........
echo ........-----:::::::::###----.........
echo ........-----****====####::::-........
echo ........-----****====####::::-........
echo .............:+::----++++-............
echo .............#::-...-:::#-............
echo .............#::-...-:::#-............
echo .............#::-...-:::#-............
echo .........--##----....---##---.........
echo ........-##--............##::-........
echo ........:+++:...-::::+++++++*:---.....
echo .....---*====----=#######====+:::-....
echo ....-:::+****::::=#######====*+++:---.
echo ----+###+---:############====####*:::-
echo ----+###+---:############====####*:::-
echo -:::+###+---:############====####*:::-
echo -:::+###+---:############====####*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::+###=====############+:::=###*:::-
echo -:::::::=####=======*::::=###+:::::::-
echo -:::::::=####=======*::::=###+:::::::-
echo ........-::::::::::::::::::::-........
echo ........-::::::::::::::::::::-........
echo ......................................
pause
goto store
)
:nextx
cls
if %potions%==0 (
echo Tut mir Leid, du hast keinen Heilungstrank!
pause
goto start
)else (
set /a health=%health%+50
set /a potions=%potions%-1
echo Du hast einen Heilungstrank getrunken
pause
goto start
)
:colorchoose1
cls
echo.
echo _____________________________
echo Lieblingsfarbe aussuchen (: /
echo ___________________________/
echo.
echo Farben:
echo ------------
echo Gruen [G]
echo Dunkelgruen [DG]
echo Tuerkis [T]
echo Blau [B]
echo Rot [R]
echo Dunkelrot [DR]
echo Lila [L]
echo Grau [Gr]
echo Gelb [Ge]
echo Weiss [WE]
echo.
echo Weiter [W]
set /p auswahl= Auswahl:
if /i %auswahl%==G goto GR
if /i %auswahl%==DG goto DG
if /i %auswahl%==T goto TU
if /i %auswahl%==B goto BL
if /i %auswahl%==R goto RO
if /i %auswahl%==DR goto DR
if /i %auswahl%==L goto LI
if /i %auswahl%==GR goto GRA
if /i %auswahl%==GE goto GE
if /i %auswahl%==WE goto WE
if /i %auswahl%==w goto MainMenu
:GR
color a
goto colorchoose1
:DG
color 2
goto colorchoose1
:TU
color 3
goto colorchoose1
:BL
color 9
goto colorchoose1
:RO
color c
goto colorchoose1
:DR
color 4
goto colorchoose1
:LI
color 5
goto colorchoose1
:GRA
color 8
goto colorchoose1
:GE
color e
goto colorchoose1
:WE
color f
goto colorchoose1
3 years ago
Currently in the process of modifying the game, it's turning out how I want it to turn out and it's looking great, I used @brotherscool123 method and I'm adding a User System and changing some things around, also decided to make it Tablet Compatible using Cross Save/Load as an option.
5 years ago
i made this by making some changes on this script copy this and make a new .bat file
@echo off
:menu
color 0c
cls
echo DRAGON KILL
echo Choose the number:
echo 1. Start game
echo 2. Exit
echo Made By Arbab
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' (
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%+50
set /a levels=%levels%+1
echo You defeated the dragon and earned $50.
echo Congratz
ping localhost -n 5 >nul
pause
goto start
:defeated
cls
echo Sorry You died!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo RIP
echo You have killed %levels% dragons
ping localhost -n 5 >nul
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
: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
)
thanks!
5 years ago
i have fixed the bugs (all of them) and upgraded it so you stay alive longer. hope you like it!
p.s. (to the maker) dont use the command: if '%choose%' == 1(goto whatever)
use: choice /c:123 /n > nul if errorlevel 1 goto whatever
it is much simpler and will go to wherever you say as soon as you press the number instead of having to press enter
@echo off
:menu
color 0a
cls
echo DRAGON KILL
echo Choose the number:
echo 1. Start game
echo 2. Exit
choice /c:12 /n > nul
if errorlevel 2 goto exit
if errorlevel 1 goto sets
:sets
cls
set /a money=1500
set /a health=1000
set /a potions=1
set /a damage=5
set /a dd=5
set /a dh=25
set /a moneygain=50
set /a levels=0
set /a new=%dh%+5
goto start
: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
choice /c:1234 /n > nul
if errorlevel 4 goto nextx
if errorlevel 3 goto menu
if errorlevel 2 goto store
if errorlevel 1 goto fight
: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%+100
set /a levels=%levels%+1
echo You defeated the dragon and earned $100.
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
choice /c:123 /n > nul
if errorlevel 3 goto start
if errorlevel 2 goto buyheal
if errorlevel 1 goto buysword
: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%+5
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%+30
set /a potions=%potions%-1
echo You have used one potion and gained 30 health
pause
goto start
)
6 years ago
i couldnt even upgrade my sword cos :buysword wasnt even a thing
6 years ago
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
7 years ago
I have made an updated version, where you are allowed to hold the enter key:
@echo off
:menu
color 0a
cls
echo DRAGON KILL
echo Choose the number:
echo 1. Start game
echo 2. Exit
echo Made by CodeSmartz and I_boom5245
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' (
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%+50
set /a levels=%levels%+1
echo You defeated the dragon and earned $50.
echo Congratz
ping localhost -n 5 >nul
pause
goto start
:defeated
cls
echo Sorry You died!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo RIP
echo You have killed %levels% dragons
ping localhost -n 5 >nul
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
: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
)