Thread: Tile-based games!

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001

    Question Tile-based games!

    I am making a tile-based game. I want to create a struct for the data from the level file. I have this:

    struct TILE
    int TEX; // Holds texture ID
    int *DIM; // Holds number of x, y tiles

    how would I create a loop and use sscanf(); to extract the amount of x, y tiles. And then, get the numbers on each tile. For example:


    Any help is appreciated!


    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User
    Join Date
    Aug 2001

    when i did this...

    i designed my own file type (use binary output not ascii)

    something like this

    [width-unsigned integer]
    [height-unsigned integer]
    [each tile structure, starting with 0,0]

    then you just read in the width and height, create your array
    and start populating with two for loops
    pretty simple stuff once you get the idea of creating your own file type

  3. #3

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. Tile based game in opengl
    By Unregistered in forum Game Programming
    Replies: 1
    Last Post: 07-16-2002, 02:45 PM
  3. Tile Based Games
    By Unregistered in forum Game Programming
    Replies: 2
    Last Post: 04-03-2002, 08:55 PM
  4. 2d non tile based
    By DavidP in forum Game Programming
    Replies: 4
    Last Post: 02-01-2002, 12:51 PM
  5. tile based gaming
    By Unregistered in forum Game Programming
    Replies: 3
    Last Post: 10-27-2001, 12:17 PM