make your video game using notepad
PC Hacks

How to Develop a Video Game With Cmd – Cool PC Tricks

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 .

How to Make a Video Game With Cmd

@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 .

How to Make a Video Game With Cmd

: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.

How to Make a Video Game With Cmd

: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.

How to Make a Video Game With Cmd

:Instructions
cls
echo Instructions
echo.
echo 'Welcome To OnlineCmag Game'
pause
goto Menu

Step 6: Begin The Game:


How to Make a Video Game With Cmd

: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.

How to Make a Video Game With Cmd

Share Your Doubts And Views In Comments ….

7 thoughts on “How to Develop a Video Game With Cmd – Cool PC Tricks

  1. vatsal mandaliya says:

    thanks! these instructions are very usefull for the gameing programers.

  2. JAMES says:

    how to make graphics for it

    1. OnlineCmag Team says:

      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.

  3. ajay bk says:

    I wanna make my own DJ program for me but don’t know how to make??

    1. OnlineCmag Team says:

      Can you please elaborate what DJ program actually means so that we could suggest you where to start.

  4. Jaydison says:

    How to make the Menu

    1. OnlineCmag Team says:

      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

Leave a Reply

Your email address will not be published. Required fields are marked *