Thread: Making a new game, graphic.

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    206

    Exclamation Making a new game, graphic.

    Code:
    main()
    {
    	char map[10][10], mapcolor[10][10];
    	int j, end;
    	HANDLE h;
    	h = GetStdHandle ( STD_OUTPUT_HANDLE );
    
    	for(int i=0;i<10;i++)
    	{
    		for(j=0;j<10;j++)
    		{
    		map[i][j] = (char)178;
    		}
    	}
    	for(i=0;i<4;i++)
    	{
    		for(j=0;j<4;j++)
    		{
    			mapcolor[i][j] = 1;
    		}
    	}
    	for(i=4;i<7;i++)
    	{
    		for(j=4;j<7;j++)
    		{
    			mapcolor[i][j] = 3;
    		}
    	}
    	for(i=0;i<10;i++)
    	{
    		for(j=0;j<10;j++)
    		{
    			switch(mapcolor[i][j])
    			{
    			case 1:
    				SetConsoleTextAttribute (h, FOREGROUND_BLUE);
    				cout<<map[i][j];
    				break;
    			case 3:
    				SetConsoleTextAttribute (h, FOREGROUND_GREEN);
    				cout<<map[i][j];
    				break;
    			default:
    				SetConsoleTextAttribute (h, FOREGROUND_RED);
    				cout<<map[i][j];
    				break;
    			}
    		}
    	cout<<"\n";
    	}
    	cin>>end;
    	return 0;
    }
    this is not working for me. It compiles and runs, but when it prints every box is the same color. what am i doing wrong? thanx in advance :-P

  2. #2
    Seven years? civix's Avatar
    Join Date
    Jul 2002
    Posts
    605
    try adding a ()after your break;'s if that doesnt work then im beat
    .

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    I think it deals with you not including windows.h........

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    you know what.. maybe its cause im not using flush.. ima go try

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    yeha that was the problem. thanks for trying to help guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help on game making
    By rtyn in forum Game Programming
    Replies: 4
    Last Post: 07-31-2008, 07:25 PM
  2. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  3. Question on making game.
    By derrick45123 in forum C++ Programming
    Replies: 10
    Last Post: 06-19-2005, 05:12 PM
  4. Reference to making breakout game
    By Raison in forum Game Programming
    Replies: 10
    Last Post: 12-31-2004, 05:18 PM
  5. Lets Play Money Making Game
    By ggs in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 09-04-2001, 08:36 PM