Chaos Project

Game Development => Sea of Code => Topic started by: G_G on August 04, 2010, 11:07:39 pm

Title: [XNA] Tilemap Help?
Post by: G_G on August 04, 2010, 11:07:39 pm
In xna, my way of drawing a map in XNA was terrible. It looped through each line of the map, reading the tile number. Then drew it. Luckily no lag but I'm sure it was an inefficient way. Another thing, my way didn't have autotiles.

Anyone know of a tilemap class or is willing to help me get started on one? Preferably one that includes autotiles :P
Title: Re: [XNA] Tilemap Help?
Post by: winkio on August 05, 2010, 01:27:05 am
I could write you the code for autotiles.  It's not hard at all.  And I made a tile engine for an xna game last fall.  I'll see if I can dig it up.

In terms of handling the actual tiles, you should have an object for each one, and you should be able to test if it's on screen as a method of that object, so each frame, you should loop through and test if each tile is on screen, and if it is, draw it.  The main advantage of objects instead of an array of numbers is that you can store more data on each tile, such as passability, terrain tag, etc.
Title: Re: [XNA] Tilemap Help?
Post by: G_G on August 05, 2010, 01:37:31 am
That'd be really helpful winkio =D If you could do that, I'd also be your, well I dunno, I'm already your bitch so xD
Title: Re: [XNA] Tilemap Help?
Post by: Agckuu Coceg on August 05, 2010, 04:52:58 am
Quote from: earthnite on August 05, 2010, 04:47:31 am
XNA? whats that?


http://en.wikipedia.org/wiki/Microsoft_XNA (http://en.wikipedia.org/wiki/Microsoft_XNA)

Runtime environment for creating games, created by Microsoft.