My first C++ game is done!

This is a discussion on My first C++ game is done! within the C++ Programming forums, part of the General Programming Boards category; You can use VK_LEFT etc./.. here VK stands for virtual key.. With this you can even get inputs like ctrl ...

  1. #31
    vasanth
    Guest
    You can use VK_LEFT etc./.. here VK stands for virtual key.. With this you can even get inputs like ctrl + some key etc etc...

  2. #32
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    none of thta makes much sense to me.
    how can i find out if the user pressed the UP arrow key if it has the same ASCII value as one of the letters?
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  3. #33
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Are you making a Windows API app, or a console-based app? I have no clue if you're making a console-based app, but for Windows I think each key has a unique virtual-key code.
    Just Google It. √

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

  4. #34
    Disguised
    Guest
    Very nice game but I believe the name of the game is in copyright violation.

  5. #35
    Registered User
    Join Date
    Aug 2002
    Posts
    170
    Error in game play.

    The pieces that look like this:


    Code:
    XXXX
       X
       XXXX

    can be turned in an improper direction. In Tetris this is 2 peices. In your game it is 1 peice that can be played in 2 ways. This makes your game much too easy.


    This should be a seperate peice.

    Code:
       XXXX
       X
    XXXX
    I think you could implement this with little difficulty.
    Best Regards,

    Bonkey

  6. #36
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Originally posted by Disguised
    Very nice game but I believe the name of the game is in copyright violation.
    Yea it is actually, it can't be a following blocks game with the name 'tris

    I don't care though, I'm not working on it anymore, it was an experiment really

    (yes, I am d00b, I re-registered)

  7. #37
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    nice avatar
    what does signature stand for?

  8. #38
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,904
    hey, umm, you know in your code where there's something like this:

    Code:
    	// Do the search
    	// I tried, and I tried to get this to work in a loop but couldn't so I gave up and did this
    	int blank_line = 0;
    	for (int row = line-2; row > 0; row--)
    		if (!gmatrix[row][0] && !gmatrix[row][1] && !gmatrix[row][2] && !gmatrix[row][3] && !gmatrix[row][4] && !gmatrix[row][5] && !gmatrix[row][6] && !gmatrix[row][7] && !gmatrix[row][8] && !gmatrix[row][9] && !gmatrix[row][10] && !gmatrix[row][11] && !gmatrix[row][12] && !gmatrix[row][13] && !gmatrix[row][14] && !gmatrix[row][15] && !gmatrix[row][16] && !gmatrix[row][17] && !gmatrix[row][18] && !gmatrix[row][19] && !gmatrix[row][20] && !gmatrix[row][21] && !gmatrix[row][22] &&
    			!gmatrix[row][23] && !gmatrix[row][24] && !gmatrix[row][25] && !gmatrix[row][26] && !gmatrix[row][27] && !gmatrix[row][28] && !gmatrix[row][29] && !gmatrix[row][30] && !gmatrix[row][31] && !gmatrix[row][32] && !gmatrix[row][33] && !gmatrix[row][34] && !gmatrix[row][35] && !gmatrix[row][36] && !gmatrix[row][37] && !gmatrix[row][38] && !gmatrix[row][39] && !gmatrix[row][40] && !gmatrix[row][41] && !gmatrix[row][42] && !gmatrix[row][43])
    		{
    			blank_line = row;
    			break;
    		}
    
    	// Put the walls back
    that's in cgamematrix.h

    You can EASILY shorten that up with a for loop

    this is how you'd do it:

    Code:
    	// Do the search
    	// I tried, and I tried to get this to work in a loop but couldn't so I gave up and did this
    	int blank_line = 0;
    	bool goahead;  //Add this as a "trigger"
    	for (int row = line-2; row > 0; row--)
    	{//proper coding to have brackets on your blocks of code :)
    		goahead=true;	//Got to reset the trigger each time
    		for(int a=0;a<44;a++)
    		{
    			if(gmatrix[row] [a])
    				goahead=false;
    		}
    		if(goahead)
    		{
    			blank_line = row;
    			break;
    		}
    	}
    
    	// Put the walls back
    that theoretically works, I haven't tried compiling it
    Last edited by jverkoey; 02-16-2003 at 12:30 PM.

  9. #39
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,904
    Originally posted by GrNxxDaY
    none of thta makes much sense to me.
    how can i find out if the user pressed the UP arrow key if it has the same ASCII value as one of the letters?
    the reason it has the same value is because when you do getch(); you have to do it twice, here is the code is used back when I was developing in Dos consoles:

    Code:
    int a=getch();
    cout << a << endl;
    if(a==224)	//224 means the arrow keys and some other stuff
    {
    	int b=getch();
    	cout << b << endl;
    }
    and you can see which key the user pressed that way....k? I didn't do any testing for the keys, because I forgot which key was which, hehe

    hope that helps

    -EDIT-
    lmao, the rest of you guys really know how to confuse a noob, lol
    Last edited by jverkoey; 02-16-2003 at 12:36 PM.

  10. #40
    Much older and wiser Fountain's Avatar
    Join Date
    Dec 2001
    Location
    Engeeeerland
    Posts
    1,158
    Yep, It worked first time flawlessly on my XP machine, and it is good.

    Liked it.
    Such is life.

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 11:44 AM
  3. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-25-2002, 12:00 AM

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