Sound and arrow key problem.

This is a discussion on Sound and arrow key problem. within the Game Programming forums, part of the General Programming Boards category; I want to make a text like game template but i don't know how to use sound in CPP Is ...

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    Sound and arrow key problem.

    I want to make a text like game template but i don't know how to use sound in CPP
    Is it playsound c://mydocu~1//beep.wav//
    Do i need to include any special file?

    And how do i make it do something if the Up arrow, left arrow etc is pressed? I don't want to make the player have to hit enter all the time.

    oh yeah, how do i make maps?
    This war, like the next war, is a war to end war.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    All of these questions an more can be answered once you tell us what OS you are using. If windows you can use the win api or dx to do the key thing. You can use dx for sound (there are others such as OpenAL but none of them are equal to dx).

  3. #3
    fry
    fry is offline
    Registered User fry's Avatar
    Join Date
    Mar 2002
    Posts
    128
    how do i make maps?
    Lol, well you would first have to code the engine to read the maps, and set your own format for storing map data, and then create a map editor (to make life easy).

    Actual implementation of that depends on your OS, which API you are going to use (unless its text based), what your game is about, what it involves, the depth of the levels you wish to create, and how they should look. There's plenty more, but thats a start. There is no real answer to that without more information about your game
    IDE: Dev C++ 5
    Lib: Allegro
    OS: Windows 2000

  4. #4
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    A map maker? Something with GR-GR-GRAPHICS????
    Ima going to needa little helpa with thata
    This war, like the next war, is a war to end war.

  5. #5
    Registered User -Xp-'s Avatar
    Join Date
    Nov 2002
    Posts
    28
    or you could just use a 3d program to make models and use them as maps or make a converter
    No I DIDN'T steal my name from Misro$ofts OS, it's pure coincidence.

    The lines around my name (-) are only there because i needed a name over the 3 character minimum letter limit

  6. #6
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Uh.... i'd rather team up with some one instead of writing a converter (i suck at programming really big things).
    I can write databases, using Binary data storage, but i have no idea what a converter would look like.
    This war, like the next war, is a war to end war.

  7. #7
    Registered User -Xp-'s Avatar
    Join Date
    Nov 2002
    Posts
    28
    well i suppose that is all a level editor is - a converter that converts the stuff you do on screen into a language that the game can understand
    No I DIDN'T steal my name from Misro$ofts OS, it's pure coincidence.

    The lines around my name (-) are only there because i needed a name over the 3 character minimum letter limit

  8. #8
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    A level/map editor sort of like using a GUI to create a level/map. It makes creating a map a lot easier, because the editor deals with all of the data. You get a graphical representation of that data from the editor. Granted you always can just hand edit the data files yourself but depending on the size and complexity of the map that will become very difficult. If you're going to be having multiple maps that are of some sort of complexity then it is almost a must that you have a map editor. When creating the editor you have to deal with how the data is going to be stored to the file and read from the file. In your actual game engine you're going to need to read in the data from the file, as well as, save the data to the file when neccessary. Hopefully that gives you a better understanding of what they're used for.

  9. #9
    Registered User -Xp-'s Avatar
    Join Date
    Nov 2002
    Posts
    28
    yeah thats a much better explanation
    No I DIDN'T steal my name from Misro$ofts OS, it's pure coincidence.

    The lines around my name (-) are only there because i needed a name over the 3 character minimum letter limit

  10. #10
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Can I use a text editor to make something like

    00000000000000000000000000000000000000
    011x11xxxx11111111111x11111111111111110
    014xxxxxxxxxx111111111111311111111111110
    02111111111111141111111112111111111110
    00000000000000000000000000000000000000

    And have code like this?

    Code:
    {
    if(space == 1)
    You are standing in a clear room.
    
    else if(space == x)
    That is a wall!
    move -- 1
    }
    This war, like the next war, is a war to end war.

  11. #11
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    That would work I guess For a game I made, it's sort of like you can be standing in any spot, and for each spot on the map (i.e. in the text editor), I put a different number made up of 1, 2, 4, or 8 added together to tell what directions you could go from there (i.e. 1 = up 2 = down 4 = left 8 = right, 1 + 2 = up or down).

    P.S. that's not how the file looked in reality, I entered the values in this format (these values are random right now):

    6 6 (grid size)
    0 2 (exit location)
    4 4 (player start)
    5 5 (monster start)
    1 (from 0,0 where can you go)
    2 (from 1,0 where you can go)
    4
    8
    3
    2
    3 (from 0,1 where can you go)

    etc.
    Last edited by Hunter2; 11-29-2002 at 05:49 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  12. #12
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Hey Hunter2! That space shooters.. something else! Did you happen to use a map editor for that using something you created? I know it's not really a map... but the stars passing by seems to be in a pattern so i was just asking.
    But how about the button pushing without hitting enter????
    should i use cin.get()? that never worked for me that way.
    This war, like the next war, is a war to end war.

  13. #13
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Actually, the stars are randomly generated (i.e. the positions and intensity) and just appear back at the top when they hit the bottom. But the button-pushing, my code involves Windows API, so you probably won't want to get into that yet, since it involves graphics

    But you can look into kbhit() or _kbhit() or something like that, it just checks if the user has pressed a key, and if so, returns true. Then if it returns true, you call getch() and it will retrieve the character that was pressed. Very useful if after you prompt the user for input, you don't want the program to stop and wait for the user to type their input and hit enter.

    P.S. kbhit() might be nonstandard, I'm not sure... gotta check up on it one of these days
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  14. #14
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Should use code such as:
    Code:
    kbhit(a)
    {
    cout << "you venture east";
    }
    kbhit(s)
    {
    cout << "you venture south";
    }
    This war, like the next war, is a war to end war.

  15. #15
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    No no, this is what you do (from my version of MSDN):
    Code:
    while(gameIsRunning)
    {
        if(_kbhit())
        {
            char c = getch();
            if(c == 'e')
                cout << "you venture east";
            else if(c == 'w')
                cout << "you venture west";
        }
    
        //whatever else the game does while the user doesn't hit a key
    }
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21