I'm making my game use only tilemaps then store the tilemap data into an XML file, which the game reads.
At the moment I have done it so it reads it from the XML.
Once it loaded it need to convert certain tiles into objects.
But when I've tried it seems to not work. I'm currently at college and can't provide cape but I will when I get home but out of memory it's something like this.
For Loop "y" in range 0,(Tilemap.Width/16)
For Loop "x" in range 0,(Tilemap.Width/16)
tilemap.TileAt(x,y) == 8 then
tilemap:removeTile(x,y)
createObject("lava",x*16,y*16)
For Loop "xx" in range loopindex("x"),(Tilemap.Width/16)-loopindex("x")
tilemap.TileAt(xx,y) == 8 then
tilemap:removeTile(x,y)
lava.width += 16
else breakloop[/code:1defa2zy]
What happens: Code works as expected however it creates multiple lava sprites on the same width
I'm guessing the loop runs side by side so it calls the function on multiple tiles.
(using shader to make sprite work like tiled background, and this isn't the problem)
I'm also sorry if this makes little to no sense.