Today we are going to show you an easy way to create your own video game with CMD. In this article, we will be giving you an introduction to video game programming. All you need to have is just a Notepad.
Steps To Create Your Own Video Game With Cmd
Step 1: Select A Title For Your Game:
Firstly, select a unique name for your game, Then Replace ” OnlineCmag Game ” With the name you wanted in the below given code .
@echo off title OnlineCmag Game
Step 2: Select The color For Your Game:
You can set the background and foreground colors by using the CMD color codes . If you don’t know the color codes click here. Replace ” 0A ” with the required color .
@echo off title OnlineCmag Game color 0A if "%1" neq "" ( goto %1)
Step 3: Creating a menu:
Type the below given code to create a menu for your game . You can also extend your menu list by repeating the code .
:Menu cls echo 1. Start echo 2. Instructions echo 3. Exit set /p answer=Type the number of your option and press enter : if %answer%==1 goto Start_1 if %answer%==2 goto Instructions if %answer%==3 goto Exit
Step 4: Creating An Exit Option:
Type the below given code to exit the game.
:Exit cls echo We Hope You Enjoyed The Game . Thanks for playing ! pause exit /b
Step 5 : Creating An Instructions Option:
Type the below given code.
:Instructions cls echo Instructions echo. echo 'Welcome To OnlineCmag Game' pause goto Menu
Step 6: Begin The Game:
:Start_1 cls echo Hurry up ! Some bad guys Surrounded You. echo They are totally 5 gang-stars echo You are having a high chance of winning. set /p answer=Would you like to fight or run ? if %answer%==fight goto Fight_1 if %answer%==run goto Run_1 pause
Step 7: Code For Fighting And Running:
:Run_1 cls echo You ran away safely ! pause goto Start_1 :Fight_1 echo Get ready for a hardcore fight. echo The battle is waging. set /p answer= Type number 1 and press enter to continue: if %answer%==1 goto Fight_1_Loop :Fight_1_Loop set /a num=%random% if %num% gtr 4 goto Fight_1_Loop if %num% lss 1 goto Fight_1_Loop if %num%==1 goto Lose_Fight_1 if %num%==2 goto Win_Fight_1 if %num%==3 goto Win_Fight_1 if %num%==4 goto Win_Fight_1 :Lose_Fight_1 cls echo Sorry, you lost the fight :( pause goto Menu :Win_Fight_1 cls echo Congrats, you won the fight!!! set /p answer='Would you like to save?' Type yes to save or type no . if %answer%=='yes' goto 'Save' if %answer%=='no' goto 'Start_2' :Save goto Start_2
Step 8: Save It:
Save this file with a ” .bat ” extension i.e something like ” OnlineCmag.bat ” . Now execute the file by double clicking on it.
Share Your Doubts And Views In Comments ….
thanks! these instructions are very usefull for the gameing programers.
how to make graphics for it
Hi James, Graphics is a big thing when it comes to video games. If you were really interested to design your own video game , i recommend you to use Gamesalad. This is the best tool i personally used it to make some computer games.
I wanna make my own DJ program for me but don’t know how to make??
Can you please elaborate what DJ program actually means so that we could suggest you where to start.
How to make the Menu
Hi Jaydison, You may find this below code useful for your question. If you have any further queries please do ping back.
ECHO OFF
CLS
:MENU
ECHO.
ECHO ………………………………………..
ECHO PRESS 1, 2 OR 3 to select your task, or 4 to EXIT.
ECHO ………………………………………..
ECHO.
ECHO 1 – Open Notepad
ECHO 2 – Open Calculator
ECHO 3 – Open Notepad AND Calculator
ECHO 4 – EXIT
ECHO.
SET /P M=Type 1, 2, 3, or 4 then press ENTER:
IF %M%==1 GOTO NOTE
IF %M%==2 GOTO CALC
IF %M%==3 GOTO BOTH
IF %M%==4 GOTO EOF
:NOTE
cd %windir%\system32\notepad.exe
start notepad.exe
GOTO MENU
:CALC
cd %windir%\system32\calc.exe
start calc.exe
GOTO MENU
:BOTH
cd %windir%\system32\notepad.exe
start notepad.exe
cd %windir%\system32\calc.exe
start calc.exe
GOTO MENU
HOW CAN I PLAY A HIDDEN GAME IN CMD