Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Creating a game!  (Read 4081 times)

0 Members and 1 Guest are viewing this topic.

simplyTechy100

    Topic Starter


    Rookie

    Thanked: 1
    • Experience: Expert
    • OS: Windows 7
    Creating a game!
    « on: March 08, 2014, 06:47:12 PM »
    This will show everything you need for atleast a intermediate game, from basic skills to sound!
    You always start with @echo off because if you don't, you will get this:
    Code: [Select]
    C:/game>echo Welcome to my game! WIP!
    Welcome to my game! WIP!
    C:/game>pause
    Press any key to continue...
    C:/game will be different, it depends on the directory you are creating the game in.
    To launch another program, make sure it is in the same folder.
    So, if we wanted to launch info.bat, we would need to get info (because that is the batch name).
    To get the last time someone played, put this after @echo off:
    Code: [Select]
    echo Last Time Played: %date% %time% > info.txtTo determine the first time played, put this code after the 2nd line:
    Code: [Select]
    echo Y for yes, N for no
    set /p ft=Is this your first time?
    if %ft%==Y echo First Time Played: %date% %time% > info.txt
    if %ft%==N goto main
    And then, info.bat will be:
    Code: [Select]
    @echo off
    type info.txt
    pause
    And then to launch it,
    Code: [Select]
    info.batDo you want it to look like a nice sky, or a devilish world?
    Use the color command.
    Quote from: C:/Users/-----/Desktop/help.txt
    Sets the default console foreground and background colors.

    COLOR [attr]

      attr        Specifies color attribute of console output

    Color attributes are specified by TWO hex digits -- the first
    corresponds to the background; the second the foreground.  Each digit
    can be any of the following values:

        0 = Black       8 = Gray
        1 = Blue        9 = Light Blue
        2 = Green       A = Light Green
        3 = Aqua        B = Light Aqua
        4 = Red         C = Light Red
        5 = Purple      D = Light Purple
        6 = Yellow      E = Light Yellow
        7 = White       F = Bright White

    If no argument is given, this command restores the color to what it was
    when CMD.EXE started.  This value either comes from the current console
    window, the /T command line switch or from the DefaultColor registry
    value.

    The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
    the COLOR command with a foreground and background color that are the
    same.

    Example: "COLOR fc" produces light red on bright white
    This way you could do:
    Code: [Select]
    color cc
    if errorlevel==1 goto colorerror
    :colorerror
    echo Attempt to set color values same > gamelog.log
    --INTERMEDIATE--
    So you want sound, eh?
    SNDREC32 /PLAY /EMBEDDED C:/game/battle.wav
    C:/game/battle.wav can be any audio file.
    -This is a ongoing development. Help can be added or edited by me at any time.-


    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Creating a game!
    « Reply #1 on: March 09, 2014, 12:26:44 AM »
    Use the color command.This way you could do:
    Code: [Select]
    color cc
    if errorlevel==1 goto colorerror
    :colorerror
    echo Attempt to set color values same > gamelog.log

    Just a comment re the code above - I didn't read most of your code as it is a wall of text and quotes, and hard to read.

    The two lines in the middle of your code above will do nothing.


    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Creating a game!
    « Reply #2 on: March 09, 2014, 07:36:10 AM »
    For future reference, a number of websites haven  games written in scripts. And there are tutorials about writing such kind of things.
    Here is none of many:
    How to Make a Large Game With Batch Script
     ;D

    simplyTechy100

      Topic Starter


      Rookie

      Thanked: 1
      • Experience: Expert
      • OS: Windows 7
      Re: Creating a game!
      « Reply #3 on: March 13, 2014, 05:21:06 AM »
      Just a comment re the code above - I didn't read most of your code as it is a wall of text and quotes, and hard to read.

      The two lines in the middle of your code above will do nothing.
      Cmon, look at this lil snippet from the help.txt!
      Quote from: C:/Users/-----/Desktop/help.txt
      The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
      the COLOR command with a foreground and background color that are the
      same.

      foxidrive



        Specialist
      • Thanked: 268
      • Experience: Experienced
      • OS: Windows 8
      Re: Creating a game!
      « Reply #4 on: March 13, 2014, 05:50:13 AM »
      Cmon, look at this lil snippet from the help.txt!

      What will your code do if it is not errerlevel 1?  Exactly the same as if it is errorlevel 1.

      simplyTechy100

        Topic Starter


        Rookie

        Thanked: 1
        • Experience: Expert
        • OS: Windows 7
        Re: Creating a game!
        « Reply #5 on: March 13, 2014, 06:32:19 PM »
        Eh.. I should have added a :1...
        OK, this is it..
        Just put a :1 at the start if you used my method of detecting COLOR errorlevel.