[Resolved] Need Help With Tile Maps

Hello!

I’ve wanted to know a little more about tile maps and i found this -http://pixels.ph4.se/2010/10/tilemaps-with-corona-part1/ and it is what i wanted but i was wondering if i could get some tiles to be set as dynamic objects or static objects based on which sprite is loaded. Can anyone either help me get this? So if the sprite was sprite 4 it would be dynamic, 0 would be nothing, and 3 would be static (just an example).

thanks,

-Boxie [import]uid: 113909 topic_id: 28715 reply_id: 328715[/import]

I used this long, long ago - but looking at the page I remember what I did.

On the line after you set the frame, do;
if spritemap.currentFrame == 1 then
– add body type for 1 here
end

etc.

Make sense?

Peach :slight_smile: [import]uid: 52491 topic_id: 28715 reply_id: 115804[/import]

sounds simple enough :slight_smile:

well i started to reply with “it’s not working it’s colliding in weird places” then i ended up setting the physics to “debug” mode and that made everything clear, it’s just in the tile map thing with all the values when it says “0” then that makes the spritemap frame as “1” and i thought it was just 0. so everything is pushed forward a value so no big deal.

it all works and i would like to say,“I love the physics.setDrawMode(“debug”) command”.

here’s the code for what you suggested.
Thanks for all the help,
-Boxie

[code]

function loadlevel (level)
local i = 1
for y=0,11,1 do
for x=0,7,1 do
– Determine which frame of the tileset to use for this sprite
– As specified by our tilemap
spritemap[i].currentFrame = tilemaps[level][(1+y)][(1+x)]+1
if spritemap[i].currentFrame == 2 then
physics.addBody(spritemap[i],“static”)
end
i = i + 1
end
end
end [import]uid: 113909 topic_id: 28715 reply_id: 115817[/import]

Great stuff - thanks very much for posting the code :slight_smile: [import]uid: 52491 topic_id: 28715 reply_id: 115885[/import]