how to create a game in notepad

Introduction of Notepad -: Notepad is a very important tool for windows. It is looks like a text editors. In the notepad we can create many type file. We can create a XML file, Text file, Bat file,HTML file etc. Notepad provide the facility for saving these file in any format. If we want to save these file in xml format we can save it or .txt file or .html file or .bat file etc. we can save it.

How to open notepad-: This is very easy to open. Notepad is already installed in your system with the operating system. If you are using window then click the start menu then select the all program button here.

After select he all program button here. Then choose the accessories button. Then a new menu will open here you get the notepad button click it. It will open.

Another way you can find the search button and write notepad and press enter.

Create a game in Notepad

For creating a game in notepad open the notepad and write the code here. For creating a game it is necessary which type game you want to create. In the notepad we used the echo ,echo. and pause etc.

echo -: echo is used to display regular text in our game.This is the first line of our game. we write this code @echo off. For example we can type: “echo welcome education game!”, and the people playing our game they will see is ” welcome education game “.It is very long so we write the @echo off.

echo.-: This is very useful in our game. It create a blank line in our game.

pause-: This is very useful command. by the help of this command we can pause the game and take the break during the game.

cls-: cls is a command that we use it. It stands for clear screen. This is use for clear the screen and what it does is remove all of the text that has been made in the command prompt window . This is a good tool when you want to keep our game looking clean and well order.

set /p variable= This command is used when we want our player to insert a variable . This could be anywhere from their name to the name of a weapon or even the answer to one of the choices we have given them. Often times this variable will be referenced later and therefore must be given a name.

if – this command is used when we create if/then statements. We can use it in conjunction with “set /p” in order to create choices for are players.

5 Fruit game example here-: Apple, Orange, Mango, Grapes, Banana.

@echo off
title game developed by netnic team
setlocal enabledelayedexpansion
:menu
cls
echo Main Menu
echo To Play A Game, Press 1
echo To Add new Words, Press 2
echo To exit, Press 3
set /p menu=
if not defined menu goto menu
if /i %menu% equ 1 (
set menu=
goto Startgame
)
if /i %menu% equ 2 (
set menu=
goto addwords
)
if /i %menu% equ 3 (
set menu=
set finishing=1
goto :EOF
)
set menu=
goto menu

:addwords
cls
Echo Type the word you'd like to add to the dictionary and press enter.
set /p wordtoadd=""
if NOT defined wordtoadd (
goto addwords)


set justchecking=1
set wcheck=0

:wordadd
call :w%wcheck%
cls
if defined finishing (goto :EOF)
echo.>>netnic.bat
echo :w%wcheck%>>netnic.bat
echo set word=%wordtoadd%>>netnic.bat
echo goto gotword>>netnic.bat
set justchecking=
set wordtoadd=
set wcheck=
echo Word Added
pause>nul
goto menu

:goodcheck
set /a wcheck= %wcheck% + 1
goto wordadd

:startgame
cls
set hang=12
set /a randomnumber=%time:~9,2%
:numberadjustment
call :w%randomnumber%
if defined finishing (goto :EOF>nul)
cls
set /a randomnumber= ( %randomnumber% * ( ( %randomnumber% * 75 ) /100 ) ) / ( %randomnumber% + 14 ) + ( %randomnumber% * 4 ) / ( %randomnumber% * 3 )
if /i randomnumber GEQ 10 (
set randomnumber=%randomnumber:~0,2%
) ELSE (
set randomnumber=%randomnumber:~0,1%
)
goto numberadjustment


:gotword
if defined justchecking (goto goodcheck)
set letternumber=0
:lettersorting
set x=!letternumber!
set Letter%letternumber%=!word:~%x%,1!
set Space%letternumber%=_
if NOT "!Letter%letternumber%!"=="" (
set /a letternumber= %letternumber% + 1
goto lettersorting
)


set space=
set /a spacenumber=0
:spacecalculator
set space=%space% #Space%spacenumber%#
set /a spacenumber= %spacenumber% + 1
if /i %spacenumber% equ %letternumber% (goto 1guess) else (goto spacecalculator)


:1guess
set score=0
set allguesses=letters:

:guess
cls
goto hang%hang%
:keepguessing
echo.
Echo Guess The fruit name: %space:#=!%
if %hang%==1 ( echo Last Guess!) else (
echo %Hang% Guesses Left 
)
echo You've guessed these %allguesses%
echo.
echo Guess Your Letter
set guess=
Set /p guess=
if not defined guess (goto guess)
set guess=%guess:~0,1%
if "%guess%"=="!" (goto guess)

echo You Guessed %guess%

if "%allguesses:~8%"=="" goto SkipCheckAlreadyGuess
echo %allguesses:~8% | find /i "%guess%" >nul
if /i %errorlevel% equ 0 (
echo You've already guessed that.
pause>nul
goto guess
)

:SkipCheckAlreadyGuess

set allguesses=%allguesses% %guess%


set poonumber=%letternumber%
if not defined score (set score=0)
if not defined oldscore (set oldscore=0)

:processguess
set verifyletter=!Letter%poonumber%!
if /i "%guess%"=="%verifyletter%" (
set /a score= !score! + 1
goto letteradjust
)
goto resume

:letteradjust
set Space%poonumber%=!Letter%poonumber%!
set !Letter%poonumber%=LETTERDONE

:resume
set /a poonumber=%poonumber% - 1
if /i %poonumber% lss 0 (goto noletter)
goto processguess



:noletter
if /i %score% GTR %oldscore% (goto gotletter)
Echo Sorry, wrong.
set /a hang= !hang! - 1
if !hang!==0 (goto dead)
pause>nul
set /a oldscore= %score%
cls
goto guess


:gotletter
echo Well done!
if %letternumber%==%score% (goto win)
pause>nul
set /a oldscore= %score%
goto guess

:dead
cls
echo Sorry, you died.
echo The word was "%word%".
pause>nul
goto endofall


:win
cls
echo You Won!
echo The word was "%word%"!
echo Well done!
pause>nul

:endofall
set space=
set cheddar=
set word=
set oldscore=
set score=
set letternumber=
set poonumber=
set spacenumber=
set anotherword=
set randomnumber=
set hang=
set guess=
set verifyletter=
set x=0
:endset
if defined Letter%x% (
set Letter%x%=
set /a x= %x% + 1
goto endset
)
set x=0
:endset2
if defined Space%x% (
set Letter%x%=
set /a x= %x% + 1
goto endset2
)
set x=

:askagain
cls
echo Go to the menu (enter 1) or quit (enter 2)?
set /p cheddar=""
if not defined cheddar goto askagain
if %cheddar%==1 (
set cheddar=
goto menu)
if %cheddar%==2 (
set finishing=1
goto :EOF)
goto askagain



:hang12
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
goto keepguessing


:hang11
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo  ________________________________
echo [________________________________]
goto keepguessing


:hang10
echo  _
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang9
echo   ______________________________
echo [ ]_____________________________]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang8
echo   _____________________________
echo [ ]____________________________]
echo [ ]   /  /
echo [ ]  /  / 
echo [ ] /  /  
echo [ ]/  /   
echo [ ]  /    
echo [ ] /     
echo [ ]/      
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang7
echo   ______________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /             (_)
echo [ ]/  /    
echo [ ]  /     
echo [ ] /     
echo [ ]/      
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]       
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang6
echo    _____________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /            _(_)_
echo [ ]/  /            / *_* \
echo [ ]  /             ] ___ [
echo [ ] /              \_____/
echo [ ]/   
echo [ ]    
echo [ ]    
echo [ ]    
echo [ ]    
echo [ ]    
echo [ ]    
echo [ ]    
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang5
echo    _____________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /            _(_)_
echo [ ]/  /            / *_* \
echo [ ]  /             ] ___ [
echo [ ] /              \_____/
echo [ ]/                 [ ]
echo [ ]                  [ ]
echo [ ]                  [ ]
echo [ ]                  [_]
echo [ ]                  
echo [ ]             
echo [ ]             
echo [ ]             
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang4
echo    _____________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /            _(_)_
echo [ ]/  /            / *_* \
echo [ ]  /             ] ___ [
echo [ ] /              \_____/
echo [ ]/                 [ ]_______
echo [ ]                  [ ]_______]
echo [ ]                  [ ]
echo [ ]                  [_]
echo [ ]                 
echo [ ]            
echo [ ]            
echo [ ]            
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang3
echo    _____________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /            _(_)_
echo [ ]/  /            / *_* \
echo [ ]  /             ] ___ [
echo [ ] /              \_____/
echo [ ]/          _______[ ]_______
echo [ ]          [_______[ ]_______]
echo [ ]                  [ ]
echo [ ]                  [_]
echo [ ]  
echo [ ]  
echo [ ]  
echo [ ]   
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing



:hang2
echo    _____________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /            _(_)_
echo [ ]/  /            / *_* \
echo [ ]  /             ] ___ [
echo [ ] /              \_____/
echo [ ]/          _______[ ]_______
echo [ ]          [_______[ ]_______]
echo [ ]                  [ ]
echo [ ]                  [ ]
echo [ ]                 / _ \
echo [ ]                /__ \ \
echo [ ]                     \ \
echo [ ]                      \_\
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:hang1
echo    _____________________________
echo [ ]__________________(-)________]
echo [ ]   /  /           (-)
echo [ ]  /  /            (-)
echo [ ] /  /            _(_)_
echo [ ]/  /            / *_* \
echo [ ]  /             ] ___ [
echo [ ] /              \_____/
echo [ ]/          _______[ ]_______
echo [ ]          [_______[ ]_______]
echo [ ]                  [ ]
echo [ ]                  [ ]
echo [ ]                 / _ \
echo [ ]                / / \ \
echo [ ]               / /   \ \
echo [ ]              /_/     \_\
echo [ ]                                      
echo [_]_____________________________
echo [________________________________]
goto keepguessing


:w0
set word=Apple
goto gotword
:w1
set word=Grapes
goto gotword
:w2
set word=Banana
goto gotword
:w3
set word=Mango
goto gotword
:w4
set word=Orange
goto gotword

After writing this code in your notepad save the file. Suppose if we are saving the file name of fruitgame then give the file name fruitname.bat and click the save button as like here.

game developed in notepad

After giving the name fruitgame.bat select save as type here All Files and click the save button. It will save in your System. After go to the file and double click. It will show in your command prompt here as like.

make a game in notepad

You can play game here and you can add some text name here as you like.

What is the Bat file -: Batch is a language that runs primarily out of our Windows command prompt. By the help of this language we can create amazing text-based games.

Leave a Comment