Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

If I am building my level from a text file

0,0,0,0,0
0,1,0,1,0
0,2,1,0,0
0,0,0,0,0

and I want to draw a large image, how do I go about doing that? do I take the image, separate it in tiles (the same size as the other ones) and then add a value to each image

0,1,2,3,4,5,6
0,7,8,9,10,11,12

or is there another way to do this? Lets say I want to add a house, or a something like this ship?

enter image description here

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Old-school RPG engines like that typically render 2 or more layers of tile maps, f.e.:

  • Ground layer (below sprites; roads, floor, etc.)
  • Upper layer (above sprites; stuff in front; the upper part of the ship in your image)

This allows sprites to walk behind stuff on the upper layer. So in your text file, you'd define 2 layers per tilemap, f.e.:

// ground layer
1,1,1,1,1,
1,2,2,1,1,
1,2,2,1,1,
1,1,1,1,1,

// upper layer
0,0,0,0,0,
0,3,0,0,3,
0,4,3,0,0,
0,0,0,0,0

(I'd recommend using 0 as "no tile")

share|improve this answer
    
very nice, so if this was a house instead of a boat, I would make some of the house tiles on the ground layers, and the rest on the upper layer. And if my house was really large (with 20 different tiles) I would set aside 20 numbers (20-40) as large house tiles –  bitbitbot Jun 6 '12 at 21:31
    
Yeah. If you have a lot of large graphics of which parts aren't reused, you could consider including arbitrarily sized tiles (although probably with dimensions that are integer multiples of a single tile), at the cost of adding some complexity to the engine/renderer. –  Torious Jun 6 '12 at 22:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.