Creating levels using Tiled maps, without using Lime

Is there a way to rig a simple level in Tiled, then export it an use it with Corona, without using Lime? If so, what do you do to be able to use the exported files?

If not, what would be the simplest way if adding tiles to a scene that will be around 28 x 28 tiles (of 128x128 pixels each)?

I´m currently using Director and inserting each tile into a localGroup, but there seem to be a limitation of about 50 tiles, any tiles over that “limit” gives the scene a runtime error. [import]uid: 44742 topic_id: 8736 reply_id: 308736[/import]

There is certainly a way to use a Tiled level in Corona without Lime, just save the map out from Tiled in whatever format you desire, then parse it and create your sprites :slight_smile:

Or if you wish to do it without Tiled I have created a VERY simple demo of just creating a map from a 1D array of tile IDs, it can be downloaded from here - http://www.grahamranson.co.uk/downloads/SimpleMap.zip [import]uid: 5833 topic_id: 8736 reply_id: 31909[/import]

anything simpler than the way I´m doing it now would be much appreciated. I will use the superb Lime+Tiled combo once everything runs smoothly there, already purchased Lime a few weeks ago.

This is me doing it the hard way, this example shows how I add a row of 28 tiles, for the sake of the example, I´ve only included 1 row of tiles even though it calls for many more functions at the end of the code. I have also in included a scrolling function attached to the player, so that I can scroll around to see if the tiles are being placed out correctly:

module(…, package.seeall)

local localGroup

local imagesA = {}
imagesA.A1 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A2 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A3 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A4 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A5 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A6 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A7 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A8 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A9 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A10 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A11 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A12 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A13 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A14 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A15 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A16 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A17 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A18 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A19 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A20 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A21 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A22 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A23 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A24 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A25 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A26 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A27 = display.newImage( “images/brickwall/stone1.png” )
imagesA.A28 = display.newImage( “images/brickwall/stone1.png” )

local function initVars ()


– Positions of the localGroup, using these to position all the other tiles

localGroup.x = 128
localGroup.y = 128

end

local function initVarsRowA ()

– INSERT ROW 1

localGroup:insert( imagesA.A1 )
localGroup:insert( imagesA.A2 )
localGroup:insert( imagesA.A3 )
localGroup:insert( imagesA.A4 )
localGroup:insert( imagesA.A5 )
localGroup:insert( imagesA.A6 )
localGroup:insert( imagesA.A7 )
localGroup:insert( imagesA.A8 )
localGroup:insert( imagesA.A9 )
localGroup:insert( imagesA.A10 )
localGroup:insert( imagesA.A11 )
localGroup:insert( imagesA.A12 )
localGroup:insert( imagesA.A13 )
localGroup:insert( imagesA.A14 )
localGroup:insert( imagesA.A15 )
localGroup:insert( imagesA.A16 )
localGroup:insert( imagesA.A17 )
localGroup:insert( imagesA.A18 )
localGroup:insert( imagesA.A19 )
localGroup:insert( imagesA.A20 )
localGroup:insert( imagesA.A21 )
localGroup:insert( imagesA.A22 )
localGroup:insert( imagesA.A23 )
localGroup:insert( imagesA.A24 )
localGroup:insert( imagesA.A25 )
localGroup:insert( imagesA.A26 )
localGroup:insert( imagesA.A27 )
localGroup:insert( imagesA.A28 )

imagesA.A1.x = localGroup.x * 1
imagesA.A1.y = localGroup.y * 1

imagesA.A2.x = localGroup.x * 2
imagesA.A2.y = localGroup.y * 1

imagesA.A3.x = localGroup.x * 3
imagesA.A3.y = localGroup.y * 1

imagesA.A4.x = localGroup.x * 4
imagesA.A4.y = localGroup.y * 1

imagesA.A5.x = localGroup.x * 5
imagesA.A5.y = localGroup.y * 1

imagesA.A6.x = localGroup.x * 6
imagesA.A6.y = localGroup.y * 1

imagesA.A7.x = localGroup.x * 7
imagesA.A7.y = localGroup.y * 1

imagesA.A8.x = localGroup.x * 8
imagesA.A8.y = localGroup.y * 1

imagesA.A9.x = localGroup.x * 9
imagesA.A9.y = localGroup.y * 1

imagesA.A10.x = localGroup.x * 10
imagesA.A10.y = localGroup.y * 1

imagesA.A11.x = localGroup.x * 11
imagesA.A11.y = localGroup.y * 1

imagesA.A12.x = localGroup.x * 12
imagesA.A12.y = localGroup.y * 1

imagesA.A13.x = localGroup.x * 13
imagesA.A13.y = localGroup.y * 1

imagesA.A14.x = localGroup.x * 14
imagesA.A14.y = localGroup.y * 1

imagesA.A15.x = localGroup.x * 15
imagesA.A15.y = localGroup.y * 1

imagesA.A16.x = localGroup.x * 16
imagesA.A16.y = localGroup.y * 1

imagesA.A17.x = localGroup.x * 17
imagesA.A17.y = localGroup.y * 1

imagesA.A18.x = localGroup.x * 18
imagesA.A18.y = localGroup.y * 1

imagesA.A19.x = localGroup.x * 19
imagesA.A19.y = localGroup.y * 1

imagesA.A20.x = localGroup.x * 20
imagesA.A20.y = localGroup.y * 1

imagesA.A21.x = localGroup.x * 21
imagesA.A21.y = localGroup.y * 1

imagesA.A22.x = localGroup.x * 22
imagesA.A22.y = localGroup.y * 1

imagesA.A23.x = localGroup.x * 23
imagesA.A23.y = localGroup.y * 1

imagesA.A24.x = localGroup.x * 24
imagesA.A24.y = localGroup.y * 1

imagesA.A25.x = localGroup.x * 25
imagesA.A25.y = localGroup.y * 1

imagesA.A26.x = localGroup.x * 26
imagesA.A26.y = localGroup.y * 1

imagesA.A27.x = localGroup.x * 27
imagesA.A27.y = localGroup.y * 1

imagesA.A28.x = localGroup.x * 28
imagesA.A28.y = localGroup.y * 1

end

– CLEAN

function clean ( event )
print(“2 cleaned”)
end


– NEW

function new()
localGroup = display.newGroup()

– Initiate variables

initVars()
initVarsRowA()
initVarsRowB()
initVarsRowC()
initVarsRowD()
initVarsRowE()
initVarsRowF()
initVarsRowG()
initVarsRowH()
initVarsRowI()
initVarsRowJ()
initVarsRowK()
initVarsRowL()
initVarsRowM()
initVarsRowN()
initVarsRowO()
initVarsRowP()
initVarsRowQ()
initVarsRowR()
initVarsRowS()
initVarsRowT()
initVarsRowU()
initVarsRowV()
initVarsRowW()
initVarsRowX()
initVarsRowY()
initVarsRowZ()
initVarsRowAA()
initVarsRowBB()
initVarsPlayer()


– MUST return a display.newGroup()

return localGroup

end
[import]uid: 44742 topic_id: 8736 reply_id: 31914[/import]

The code provided in my download should get you going with creating the actual map in an easier way than what you have now. [import]uid: 5833 topic_id: 8736 reply_id: 31916[/import]

I wouldn´t know how to parse the map, neither do I know what parse means, but that´s my problem :slight_smile:

Would I be able to use data from the Physics editor with the SimpleMap example you posted above here? [import]uid: 44742 topic_id: 8736 reply_id: 31918[/import]

Parsing would be writing code that can handle the Tiled map format and then allowing you to do something with it. If you open up a Tiled map in a text editor you will be able to look at the Map format (assuming you have chosen an uncompressed format such as XML). You just need to be able to deal with that format in your code.

You would be able to do whatever you want with it, all the code does is create a bunch of sprites from a list of IDs (using a spritesheet) and positions them in the correct place. The rest will be up to you :slight_smile:

There are also some basic map attributes such as map and tile size. [import]uid: 5833 topic_id: 8736 reply_id: 31919[/import]

Alrighty, I will have a look at the sample you linked and see if I can make sense of it, first thing tomorrow after work. I´m not the programmer in our team (thank god), just wanting to learn how to use Corona for myself alongside designing our games and creating the graphics for them.

Thanks for the help so far! [import]uid: 44742 topic_id: 8736 reply_id: 31921[/import]

No worries, happy to help! [import]uid: 5833 topic_id: 8736 reply_id: 31930[/import]