1
\$\begingroup\$

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

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

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")

\$\endgroup\$
2
  • \$\begingroup\$ 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 \$\endgroup\$ Commented Jun 6, 2012 at 21:31
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 6, 2012 at 22:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.