Introduction: How to Create a Simple, Basic, Computer Game With Batch
Alright so you know a little batch eh? You wanna make a computer game now, well lets examine the basics. You can make a text based game, like a quiz game or something, but you can not and i mean CAN NOT make a multiplayer warfare game with upgrading towers and training your soldiers, dont bother trying to do anything with graphics. So lets get started
Step 1: Making the Quiz
a quiz is better and easier for beginners, and for learning so we will make a quiz game. So we will start off by making a startup menu
by typing
@echo off
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
title QUIZAMO
by typing
@echo off
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
title QUIZAMO
Step 2: Inputs and Labels
Now we have this:
@echo off
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
title QUIZAMO
but we need to label it as main:
@echo off
:MAIN
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
title QUIZAMO
Now we need to add some questions, but first access them
So type this next:
set /p input=Start?
if %input%==start goto QUESTION1
if %input%==quit exit
Perfect
@echo off
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
title QUIZAMO
but we need to label it as main:
@echo off
:MAIN
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
title QUIZAMO
Now we need to add some questions, but first access them
So type this next:
set /p input=Start?
if %input%==start goto QUESTION1
if %input%==quit exit
Perfect
Step 3: Questions
Alright now that we have the Main Menu we need the game itself. Here is an example:
:QUESTION1
echo What is yours but used more by others
set /p input=Answer?
in %input%==name goto QUESTION2
echo WRONG
goto MAIN
:QUESTION2
cls
echo CORRECT
echo.
echo The man that makes it doesn't use it, the man who buys it doesn't need it, the man that uses it doesn't want it. What is it?
set /p input=Answer?
in %input%==coffin goto QUESTION3
echo WRONG
goto MAIN
:QUESTION3
cls
echo CORRECT
echo.
echo What goes up but dont come down
set /p input=Answer?
if o%input%==age goto WINNER
echo WRONG
goto MAIN
:QUESTION1
echo What is yours but used more by others
set /p input=Answer?
in %input%==name goto QUESTION2
echo WRONG
goto MAIN
:QUESTION2
cls
echo CORRECT
echo.
echo The man that makes it doesn't use it, the man who buys it doesn't need it, the man that uses it doesn't want it. What is it?
set /p input=Answer?
in %input%==coffin goto QUESTION3
echo WRONG
goto MAIN
:QUESTION3
cls
echo CORRECT
echo.
echo What goes up but dont come down
set /p input=Answer?
if o%input%==age goto WINNER
echo WRONG
goto MAIN
Step 4: Winning
Now you have the Main Menu, and the game itself, what happens when you win? try this:
:WINNER
cls
echo YOU WON
echo.
echo YOU HAVE 5 MILLION DOLLARS NOW
echo.
echo CONGRATS
echo.
echo Play again?
set /p input=Play?
if %input%==yes goto MAIN
if %input%==no exit
There you have completed your game, pleas leave comments on how well this worked for you!
COMPLETE FINISHED SCRIPT:
@echo off
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
set /p input=Start?
if %input%==start goto QUESTION1
if %input%==quit exit
:QUESTION1
echo What is yours but used more by others
set /p input=Answer?
in %input%==name goto QUESTION2
echo WRONG
goto MAIN
:QUESTION2
cls
echo CORRECT
echo.
echo The man that makes it doesn't use it, the man who buys it doesn't need it, the man that uses it doesn't want it. What is it?
set /p input=Answer?
in %input%==coffin goto QUESTION3
echo WRONG
goto MAIN
:QUESTION3
cls
echo CORRECT
echo.
echo What goes up but dont come down
set /p input=Answer?
in %input%==age goto WINNER
echo WRONG
goto MAIN
:WINNER
cls
echo YOU WON
echo.
echo YOU HAVE 5 MILLION DOLLARS NOW
echo.
echo CONGRATS
echo.
echo Play again?
set /p input=Play?
if %input%==yes goto MAIN
if %input%==no exit
:WINNER
cls
echo YOU WON
echo.
echo YOU HAVE 5 MILLION DOLLARS NOW
echo.
echo CONGRATS
echo.
echo Play again?
set /p input=Play?
if %input%==yes goto MAIN
if %input%==no exit
There you have completed your game, pleas leave comments on how well this worked for you!
COMPLETE FINISHED SCRIPT:
@echo off
echo Welcome To Quizamo
echo Where you try to answer all 3 questions to win, 5 MILLION DOLLARS!!!
echo So would you like to start or quit?
set /p input=Start?
if %input%==start goto QUESTION1
if %input%==quit exit
:QUESTION1
echo What is yours but used more by others
set /p input=Answer?
in %input%==name goto QUESTION2
echo WRONG
goto MAIN
:QUESTION2
cls
echo CORRECT
echo.
echo The man that makes it doesn't use it, the man who buys it doesn't need it, the man that uses it doesn't want it. What is it?
set /p input=Answer?
in %input%==coffin goto QUESTION3
echo WRONG
goto MAIN
:QUESTION3
cls
echo CORRECT
echo.
echo What goes up but dont come down
set /p input=Answer?
in %input%==age goto WINNER
echo WRONG
goto MAIN
:WINNER
cls
echo YOU WON
echo.
echo YOU HAVE 5 MILLION DOLLARS NOW
echo.
echo CONGRATS
echo.
echo Play again?
set /p input=Play?
if %input%==yes goto MAIN
if %input%==no exit
Step 5: Tips, and Warnings
TIPS
- You can change the color by typing in color then the colorcode, to find the colorcodes open cmd promt and type color /?
-To add graphics(I have not tested this) I heard you can use an DOS photo editor or something, or open a photo with a cmd
-You can add more questions easily by copy and pasting from question# to the line b4 question#+1
WARNINGS
-Do not set up a questionaire to steal peoples passwords, that is illegal and abusing the priveledge of the game
- You can change the color by typing in color then the colorcode, to find the colorcodes open cmd promt and type color /?
-To add graphics(I have not tested this) I heard you can use an DOS photo editor or something, or open a photo with a cmd
-You can add more questions easily by copy and pasting from question# to the line b4 question#+1
WARNINGS
-Do not set up a questionaire to steal peoples passwords, that is illegal and abusing the priveledge of the game