Results 1 to 3 of 3

Thread: Need help from Fox or any1 who knows tile engines...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Exclamation Need help from Fox or any1 who knows tile engines...

    Fox or whoever,

    I saw a thread about how a person setup a tile map using DirectDraw adn the map looked something like this...

    1203104
    2012310
    3122310
    3122310

    Where 0 would be grass, 1 whatever, 2 whatever, and so on...

    Do you know what I mean??? I hope so...

    My question is... What is the principle behind this? It seems like a pretty simple way of doing things, if I could only grasp the concept.

    I'm pretty new to direct draw, so you might want to be a little explanitory in your reply...

    Thanx in Advance,
    Squirrelly1

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    You would replace each instance of 0 with a grass tile, say you had an array of these:
    VB Code:
    1. Dim Map(5,5) As Integer
    2. Dim I, J
    3. For I = 0 to 4
    4. For J = 0 to 4
    5. Select Case Map(J,I)
    6. Case 0
    7.    DrawTile ddPath, J * TILE_WIDTH, I * TILE_HEIGHT
    8. Case 1
    9.    DrawTile ddMountain, J * TILE_WIDTH, I * TILE_HEIGHT
    10. Case 2
    11.    DrawTile ddForest, J * TILE_WIDTH, I * TILE_HEIGHT
    12. Case 3
    13.    DrawTile ddPlains, J * TILE_WIDTH, I * TILE_HEIGHT
    14. Case 4
    15.    DrawTile ddLava, J * TILE_WIDTH, I * TILE_HEIGHT
    16. Case 5
    17.    DrawTile ddGrass, J * TILE_WIDTH, I * TILE_HEIGHT
    18. Case 6
    19.    DrawTile ddWater, J * TILE_WIDTH, I * TILE_HEIGHT
    20. Case 7
    21.    DrawTile ddDirt, J * TILE_WIDTH, I * TILE_HEIGHT
    22. End Select
    23. Next J
    24. Next I
    This is of course a bad way of doing things, you may have DrawTile Tiles(Map(J,I)), J * TILE_WIDTH, I * TILE_HEIGHT, which would be a lot better and easier. DrawTile would be a hand-made function, a wrapper for DirectDraw when drawing a tile. TILE_WIDTH and _HEIGHT would be how big your tiles were (16x16, 32x32, etc.)
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Moving on...

    Sastraxi,

    Thanx for the help, and exspecially the code! I understood that I would have to replace the numbers with a picture of some sort (tile), but wasn't sure how...

    Thanx,
    Squirrelly1

    P.S. If I run into any more problems, I'll be sure to post them for you VB Wizards out there!
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width