|
-
Oct 14th, 2001, 08:01 AM
#1
Thread Starter
Frenzied Member
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
-
Oct 14th, 2001, 08:48 AM
#2
Good Ol' Platypus
You would replace each instance of 0 with a grass tile, say you had an array of these:
VB Code:
Dim Map(5,5) As Integer
Dim I, J
For I = 0 to 4
For J = 0 to 4
Select Case Map(J,I)
Case 0
DrawTile ddPath, J * TILE_WIDTH, I * TILE_HEIGHT
Case 1
DrawTile ddMountain, J * TILE_WIDTH, I * TILE_HEIGHT
Case 2
DrawTile ddForest, J * TILE_WIDTH, I * TILE_HEIGHT
Case 3
DrawTile ddPlains, J * TILE_WIDTH, I * TILE_HEIGHT
Case 4
DrawTile ddLava, J * TILE_WIDTH, I * TILE_HEIGHT
Case 5
DrawTile ddGrass, J * TILE_WIDTH, I * TILE_HEIGHT
Case 6
DrawTile ddWater, J * TILE_WIDTH, I * TILE_HEIGHT
Case 7
DrawTile ddDirt, J * TILE_WIDTH, I * TILE_HEIGHT
End Select
Next J
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)
-
Oct 14th, 2001, 09:15 AM
#3
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|