Thread: Tetris Help

  1. #1
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Tetris Help

    I would like to know how you would get the bricks to show correctly. What I mean by this is would I do a 2D array, or is there an easier way of this?

  2. #2
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    i did a 3d array and my game is runnin fine now...

    just make somethin like this

    Code:
    short Iblock[4][4][4] = {
                       {
                       {0, 0, 1, 0},
                       {0, 0, 1, 0},
                       {0, 0, 1, 0},
                       {0, 0, 1, 0}
                                  },
    
                       {
                       {0, 0, 0, 0},
                       {0, 0, 0, 0},
                       {1, 1, 1, 1},
                       {0, 0, 0, 0}
                                  },
    
                       {
                       {0, 0, 1, 0},
                       {0, 0, 1, 0},
                       {0, 0, 1, 0},
                       {0, 0, 1, 0}
                                  },
    
                       {
                       {0, 0, 0, 0},
                       {0, 0, 0, 0},
                       {1, 1, 1, 1},
                       {0, 0, 0, 0}
                                  }
                                  };
    the just use some for loops to draw to screen...
    What is C++?

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Thank you. I get to work on that tomorrow....

  4. #4
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Are you gonna have music in your game?

    I tried to load some midi file but it wouldnt play.. Any ideas why?
    What is C++?

  5. #5
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Vicious, I know how to play .wav files (I'm not sure if this will work with .midi files or for that matter I'm not even familiar with MIDI except what I read in the Allegro docs).

    install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, 0);

    // to install the sound inside main()

    SAMPLE *name;

    //to declare ths .wav before main()

    name = load_sample("name.wav");

    // to load the .wav inside main()

    play_sample(name, 128, 128, 500, FALSE);

    //to play the .wav once

    /* if you want to play a .wav in a loop then you change FALSE to the number of times you want the .wav to loop. if you want the loop to stop then you use stop_sample(name). i should mention that you don't use stop_sample(name) if you don't use a loop for you .wav */

    my shooter game i was making had some pretty cool sound effects in it too. you can get them from www.a1freesoundeffects.com hopefully that's the right address.

  6. #6
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    oh wow, after checking to make sure that link is right, i noticed that the a1freesoundeffects site has been redone. it looks pretty good. hopefully all of the same free sounds are there. they must have just done this in the past 2-3 days.

  7. #7
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    To load music, just define the midi name like this:
    Code:
    MIDI *(enter name here);
    where (enter name here) would be the name of the midi, and then set the volume like TechWins said, and then look at the docs for playing, because there are a few (namely looped, and play-to-end). Hope that helped.

  8. #8
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    well i know all that...

    I loaded everything right it just wouldnt play it...
    What is C++?

  9. #9
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Ohh...what libraries did u link it with anyways?

  10. #10
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Allegro....

    What is C++?

  11. #11
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    .......did u use the alleg_s.a?

  12. #12
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    .. um, no....

    ..............


    um, what the crap is that anyway?
    What is C++?

  13. #13
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    In the lib directory (if your using Dev-C++ one from the package section of their website), there is a .a file that is called liballeg_s.a

  14. #14
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    is that for sound or something?

    will it work as well as liballeg.a?


    What is C++?

  15. #15
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    i don't know, I can't get it working honestly

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Game Idea (Tetris Maze)
    By SlyMaelstrom in forum Game Programming
    Replies: 13
    Last Post: 06-07-2006, 05:48 PM
  2. how to write a Tetris [newbie]
    By lifeisendless4m in forum C Programming
    Replies: 2
    Last Post: 10-12-2004, 09:38 PM
  3. ARGHARHGAHRHGH Help with Tetris
    By KneeGrow in forum Tech Board
    Replies: 3
    Last Post: 09-09-2004, 11:40 PM
  4. Test my new tetris game
    By PJYelton in forum Game Programming
    Replies: 6
    Last Post: 04-19-2003, 05:21 PM
  5. AGS Tetris Clone
    By Damascus in forum Game Programming
    Replies: 1
    Last Post: 03-07-2003, 05:17 PM