Can we create a Level Editor via Corona GE?

i made some amends… i dont know if it’s right or wrong but i thought maybe it’s better to have one spriteSet per layer eg

then again that wouldn’t allow for animated tiles :wink:

actually it probably doesnt make any difference… it’s all just coming from one bitmap anyway isnt it. I was thinking the spriteSet created a separate texture on the GPU whereas it’s probably just a table of indices
[lua]-- ORIGINAL
–self = sprite.newSprite( tileSet.spriteSets[0 + dataBackup.gid] )

–AMEND.
– one set with multiple tiles
self = sprite.newSprite(tileSet.spriteSets[1])
self.currentFrame=0+dataBackup.gid[/lua]
and
[lua]-- ORIGINAL
–for i=1, self.tileCount, 1 do
– self.spriteSets[i] = sprite.newSpriteSet(self.spriteSheet, i, 1)
–end

– AMEND
self.spriteSets[1]=sprite.newSpriteSet(self.spriteSheet,1,self.tileCount)[/lua]

[import]uid: 6645 topic_id: 3534 reply_id: 10836[/import]

Ah ha, currentFrame is exactly what I was looking for so thank you for that :slight_smile: I have added that in and will hopefully get multiple tilesets working tomorrow. I also want to take a look at getting object layers working as that looks pretty cool.

Nite nite (this time for real :slight_smile: ), any more comments, updates etc just post them here or email them to me on my site and I will look at them when I get up. [import]uid: 5833 topic_id: 3534 reply_id: 10837[/import]

I’m trying to get each layer to get each TMX layer to be a displayGroup however when I do so I just get a black screen, I have uploaded the code here and if you (or anyone else) could take a quick look at it that would be great.

The layer group is created on line 192 of lime (originally it was just a table) and on line 278 I insert it into the map group and on line 121 I insert the tile sprite into the layer group.

Commenting out lines 278 and 121 (and commenting back in line 311) plus changing 192 back to a standard table will allow the map to be drawn.

The plan is that when layers are all groups you can just call map:getLayer(layerName) in order to insert things like enemies on specific levels, for example line 15 of main.lua which which will need to be commented back out like the other lines if you want to see the map loading without layers working properly. [import]uid: 5833 topic_id: 3534 reply_id: 10858[/import]

Version 0.3 is now available, now with multiple tilesets :slight_smile: [import]uid: 5833 topic_id: 3534 reply_id: 10862[/import]

Version 0.4 is up, object layers (and object properties) are now working.

I need to write some helper functions to ease the access to things like objects and properties but at least it is all being imported properly. [import]uid: 5833 topic_id: 3534 reply_id: 10868[/import]

Version 0.5 is up, just added some helper functions for getting at Properties, Layers and Objects. Still trying to sort the layering stuff. [import]uid: 5833 topic_id: 3534 reply_id: 10875[/import]

at this rate v1.0 is going to be aweseome :wink:

personally I would not have the class return the displayObject directly, so that you could then instantiate the map without needing to instantate the display if required.

eg
[lua]map = lime.loadMap(“map.tmx”)

function loadMap(filename)

local self = {}
self.world = display.newGroup()[/lua] [import]uid: 6645 topic_id: 3534 reply_id: 10878[/import]

Keep up the fantastic work on this !!

[import]uid: 6981 topic_id: 3534 reply_id: 10880[/import]

The plan is that version 1.0 will support the full feature set of Tiled (well maybe not full as I’m not sure about gzip compression stuff or Isometric maps).

Yea I think that could be a good idea about the separation, I will give it a think.

Edit - I’ve now updated it so that a Map object has a map.world property which is the actual displayGroup however haven’t uploaded the changes yet, will wait till I have more changes.

I have also just checked out of curiosity to see if it works on my Android phone (HTC Hero) and it does, which is nice. [import]uid: 5833 topic_id: 3534 reply_id: 10879[/import]

Thank you very much, I intend to :slight_smile: [import]uid: 5833 topic_id: 3534 reply_id: 10882[/import]

Ah ha, that has fixed it :slight_smile: For some reason it didn’t like having the layer object itself as the group so splitting that up has worked :slight_smile:

You can now do stuff like this:

  
local map = lime.loadMap("map.tmx")  
  
map:prepare()  
  
local layer = map:getLayer("Ground")  
  
layer:insert(display.newImage("Person.png"))  
  

I have uploaded version 0.6 now. [import]uid: 5833 topic_id: 3534 reply_id: 10884[/import]

Should I submit this to the Code Exchange section or do you think it isn’t quite ready yet? [import]uid: 5833 topic_id: 3534 reply_id: 10886[/import]

what about something like…

[lua]function self:prepare()

for i=1, #self.layers, 1 do
local layer = self.layers[i]

layer.g = display.newGroup()
self:insert(layer.g)

for j=1, #layer.tiles, 1 do
local sprite = layer.tiles[j]:createSprite(j)

if(sprite) then
–self:insert(sprite)
layer.g:insert(sprite)
[/lua]

in main.lua
[lua]people = map:getLayer(“People”).g

local onUpdate = function(event)

people.x=people.x+1[/lua]

you’ll see the people walk behind the house. of course it’ll break your scroller because the people make the display group wider

eventually it’ll probably need a setXY() function or something to make sure anything moved in the world is kept within bounds. although actually i’m not sure how gameplay will be separated out from the map system. maybe it shoulnd’t be part of the tilemap engine at all… but rather

if(player.x> > map.getBoundsX()) etc

[import]uid: 6645 topic_id: 3534 reply_id: 10883[/import]

do it at v1.0 i reckon. i’d get some input from the forum first.

[import]uid: 6645 topic_id: 3534 reply_id: 10887[/import]

Yea true, input would be good :slight_smile: Need some more people to see this post and reply (or perhaps I should just make a post specifically for Lime) [import]uid: 5833 topic_id: 3534 reply_id: 10890[/import]

i get a black screen opening up that demo, but no errors [import]uid: 6645 topic_id: 3534 reply_id: 10889[/import]

Version 0.6? It works here, I unzipped the upload and ran it. Perhaps the download got corrupted somehow. [import]uid: 5833 topic_id: 3534 reply_id: 10891[/import]

it was lime_layertest. working now. thanks [import]uid: 6645 topic_id: 3534 reply_id: 10895[/import]

Ah right yea, that was the broken version anyway. Ignore that version just stick to the current 0.6 on my site :slight_smile: [import]uid: 5833 topic_id: 3534 reply_id: 10896[/import]

I’ve just created a fresh post - http://developer.anscamobile.com/forum/2010/11/12/introducing-lime-module-import-2d-tilemaps-your-game - hopefully people will see it and provide some feedback. [import]uid: 5833 topic_id: 3534 reply_id: 10898[/import]