Thread: Tile based in console...?

  1. #1
    Registered User got matt?'s Avatar
    Join Date
    Mar 2002
    Posts
    16

    Unhappy Tile based in console...?

    ARGGH
    Somehow I think curiosity is going to kill the cat her but...
    Is it possible to make a console tile game. I was thinking about using a 2d array of numbers. 1 can be walked on 0 cant.
    Lets say this is my array:

    Int array[6][6]=
    [111111]
    [100011]
    [100001]
    [101001]
    [100001]
    [100001]
    [111111];

    (Msvc++)

    this would mean a whole different movement then Ive been using. (Just a gech(); switch with putxy()

    how could I go about making the 1's apear as a specific character and the zeros as well. Thanks if you can help
    "If there is a will, there is a way."

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    94
    Code:
    for (int i=0; i<6; i++)
    {
         for (int j=0; j<6; j++)
         {
              switch(array[6][6])
              {
              case 1:
                   cout << char1;
                   break;
              case 0:
                   cout << char0;
                   break;
              }
         }
         cout << "\n";
    }
    It's simple as that. char1 and char2 can be any character you'd like to show.

    Brendan
    Draco dormiens nunquam titillandus

  3. #3
    Unregistered
    Guest

    function

    create a function that reads the array, and creates a new vector based on what was in the original array. with this, you can say make an 'x' for every 1 you have.. if you are always using a 6x6 it should be easy. I am not sure of if there is a way to actually change the numbers within the array to characters.. but changin the output to a vector and converting to desired text would work. (you should also try a matrix.. it might work better.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need testers for editor
    By VirtualAce in forum Game Programming
    Replies: 43
    Last Post: 07-10-2006, 08:00 AM
  2. Elegant console based menus
    By Casey in forum C++ Programming
    Replies: 2
    Last Post: 07-08-2003, 11:58 AM
  3. DOS / Linux Console based GUI?
    By mart_man00 in forum C Programming
    Replies: 3
    Last Post: 09-14-2002, 12:46 AM
  4. Tile based game in opengl
    By Unregistered in forum Game Programming
    Replies: 1
    Last Post: 07-16-2002, 02:45 PM
  5. 2d non tile based
    By DavidP in forum Game Programming
    Replies: 4
    Last Post: 02-01-2002, 12:51 PM