Dear Friends,
Today, I am going to share a very useful trick with all of you. In today’s tutorial, I will show you the procedure “How to create Game”…
Yes, you can create your own game at your home and you can edit the code, add different things in it.
Learn, How to create a Game?
You just need to follow the following steps:
- Open Notepad
- Copy the following Code highlighted in red and paste in the Notepad
@echo off
color b0
:menu
cls
echo Asalam o Alaikum! Welcome to the game!
echo 1) start!
echo 2) how to play
echo 3) Exit :,(
set /p number=
if %number% == 1 goto startgame
if %number% == 2 goto help
if %number% == 3 goto exit
:startgame
cls
echo TYPE YOUR NAME:
set /p name=
echo Hello %name%!
echo Do you want to start the quiz? (y/n)
set /p start=
if %start% == y goto level1
if %start% == n goto menu
goto startgame
:help
cls
echo Press the number of the answer then hit enter.
echo go back? (y/n)
set /p menugoto=
if %menugoto% == y goto menu
if %menugoto% == n goto exit
goto help
:exit
exit
goto exit
:level1
cls
echo Okey, Let’s Start.
echo what is 10 + 10?
echo 1) 1
echo 2) 20
echo 3) 500
set /p answer1=
if %answer1% == 1 goto wrong1
if %answer1% == 2 goto correct1
if %answer1% == 3 goto wrong1
goto level1
:correct1
echo You are right! Next Level? (y/n)
set /p NL1=
if %NL1% == y goto level2
if %NL1% == n goto menu
goto correct1
:wrong1
Echo Sadly, you were wrong. Retry? (y/n)
set /p WA1=
if %WA1% == y goto level1
if %WA1% == n goto menu
goto wrong1
:level2
cls
echo What is 10 * 10?
echo 1) 10
echo 2) 50
echo 3) 100
echo 4) 500
set /p aa=
if %aa% == 1 goto wrong2
if %aa% == 2 goto wrong2
if %aa% == 3 goto correct2
if %aa% == 4 goto wrong2
goto level2
:correct2
cls
echo YOU WIN THE GAME!
goto correct2
:wrong2
cls
echo YOU LOST! RETRY GAME? (y/n)
set /p retry=
if %retry% == y goto level1
if %retry% == n goto exit
- Save the document.
- Name the document and add .bat at the end of the document, save it anywhere in your computer, I am going to save it on my desktop
- Open the Game and follow the instructions to play 🙂
I hope you will enjoy