Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by GlergHendershmidt

Hello,

I am creating layers programmatically. I'm having trouble understanding how to construct the JSON correctly, specifically how to populate the data[ ] array. Given a tileset how do I know what number to put in each cell of the grid?

I'm looking at the docs here: http://impactjs.com/documentation/class-reference/game#loadlevel

but it does not explain how the numbers map to the tile sheet.

Thanks.

1 decade ago by alexandre

Tileset indices start at 1, with 0 reserved for absence of--read, blank--tile. For example, data for a layer of 4 rows of 4 columns that is void of tiles except for the NW and SE corners which "hold" the first tile in the associated sheet, would be:

data:[
	[1,0,0,0],
	[0,0,0,0],
	[0,0,0,0],
	[0,0,0,1]]
Page 1 of 1
« first « previous next › last »