Beta Updates

Is that after you have called the function and trying to do something with the returned tile? If so it may be that there wasn’t a tile in that position (or more like there is an actual bug :slight_smile: ) [import]uid: 5833 topic_id: 4422 reply_id: 16027[/import]

Got another issue.

When using row/column on layer:getTileat - it works fine, but when using x/y… I get…

attempt to index local 'tile' (a nil value)

Edit: Getting it on column/row as well now, code below.

[code]
local a = player.x + 3.5
local worldPosition = { x = a, y = player.y }
local tilePosition = ugni.worldToTilePosition(map, worldPosition)
local layer = map:getLayer( “Collision” )
local tile = layer:getTileAt({row=tilePosition.row, column=tilePosition.column})
local property = tile:getProperty( “collide” )

print( property[‘collide’] )
[/code] [import]uid: 13089 topic_id: 4422 reply_id: 16026[/import]

Hmm, I’ll try creating a layer of transparent tiles - I assumed it returned nil if no tile existed ;).

Edit: Creating a layer of transparent tiles worked, however instead of returning nil when the property doesn’t exist, it’s giving a property doesn’t exist error.

Edit 2: Got around the problem by filling the rest of the layer with transparent tiles and just using the hasProperty function. [import]uid: 13089 topic_id: 4422 reply_id: 16028[/import]

Hmm, is it crapping out on getTile or getProperty? [import]uid: 5833 topic_id: 4422 reply_id: 16029[/import]

It’s simple to reproduce really, just use the default isometric (or the map that I already sent you):

  1. Create a point(such as player spawn point) in an object layer on anywhere
  2. Display a circle on that point in corona after reading in the map
  3. The circle won’t be where the object layer resides in Tiled

If this doesn’t work for you, let me know, I will create an example application (which basically doing all the 3 steps described above :P) [import]uid: 11334 topic_id: 4422 reply_id: 16031[/import]

Yup, I can reproduce it. It looks like Cocos2D has the same problem, just looking at how they (well a user) has fixed it there.

Also, Berries! - http://developer.anscamobile.com/forum/2011/01/11/introducing-berries [import]uid: 5833 topic_id: 4422 reply_id: 16035[/import]

Graham,

Is there any way to get lime to return layer visuals instead of the entire map? Say I have a map with 4 layers, lime.createVisual would return the entire thing for me to insert in to my display group. Since I want to have my own z-layer handling, is there a way to return separate layers? Such as lime.createLayerVisual(“layer1”)? Would be a great feature if at all possible :).

Thanks! [import]uid: 13089 topic_id: 4422 reply_id: 16043[/import]

Currently the only way to do that would be to create the map as normal and then hide it. You could then get access to each layer individually via map:getLayer(name) and then the visual is gotten via layer.group and insert them in to your z-ordered group how you like however naturally this might not be the best way for it to work.

Would you want it to be that you load up the map as usual and then instead of creating the whole map in one you would instead call the lime.createLayerVisual(name) function for each one individually? [import]uid: 5833 topic_id: 4422 reply_id: 16046[/import]

Would be great if I could do that, since our sprite handling is done separately to Lime, we have no way to work with a foreground layer in an efficient manner. If we could call the createLayerVisual(name) function for each layer, we could do…

vl1 = lime.createLayerVisual("background") vGroup:insert(vl1) vl2 = lime.createLayerVisual("collision") vGroup:insert(vl2) vGroup:insert(sprite) vl3 = lime.createLayerVisual("foreground") vGroup:insert(vl3)

Does that make sense? [import]uid: 13089 topic_id: 4422 reply_id: 16047[/import]

Yup that makes perfect sense, looking into it now. [import]uid: 5833 topic_id: 4422 reply_id: 16048[/import]

Done :slight_smile:

It will be in the next version, which can be now if you want it :slight_smile: [import]uid: 5833 topic_id: 4422 reply_id: 16050[/import]

Now would be good ;).

What’s the syntax usage? [import]uid: 13089 topic_id: 4422 reply_id: 16051[/import]

You load the map as usual but then instead of calling lime.createVisual() you instead call -

local layer = lime.createLayer(map, “LayerName”)

This naturally won’t be inserted into the map.world displayGroup, however you are welcome to do so if you wish allowing you to still have your own z-ordering, and then if you build the map after that it *should* still all work fine (assuming you are using physics)

Would you want to be able to create one of the maps separately and then also create the rest later on like normal but without recreating any layers you have created separately?

New version - http://justaddli.me/downloads/builds/beta/LimeBeta1.6.zip [import]uid: 5833 topic_id: 4422 reply_id: 16053[/import]

Not using the physics engine at all, just box collision. :slight_smile:

I’ll test this out and get back to you soon! [import]uid: 13089 topic_id: 4422 reply_id: 16055[/import]

Awesome, hope it all works as expected.

Out of curiosity, what is your performance like on hardware without using physics? [import]uid: 5833 topic_id: 4422 reply_id: 16056[/import]

I’ll do a build in a moment and test for you with the latest revision. [import]uid: 13089 topic_id: 4422 reply_id: 16058[/import]

Awesome thanks. I’ve just realised we’ve done it again. 4am. [import]uid: 5833 topic_id: 4422 reply_id: 16059[/import]

Hmm, in the following - I get the error “bad argument #-2 to ‘insert’ (Proxy expected, got nil)”. It’s referencing my attempt to insert in to my existing display group. Or have I done something completely wrong? :stuck_out_tongue:

Code past that point renders the sprite, controls, e.t.c; all of which are in the same display group - but not appearing due to what I assume is the error.

[code]
local map = lime.loadMap( “map001.tmx” )
–local visual = lime.createVisual( map )

local v1 = lime.createLayer( map, “Background” )
local v2 = lime.createLayer( map, “BGC” )

print( "Map Resolution: " … map.height … “:” … map.width )
print( “Rendering world visual.” )

–localGroup:insert( visual )
localGroup:insert( v1 )
localGroup:insert( v2 )
[/code] [import]uid: 13089 topic_id: 4422 reply_id: 16061[/import]

Sorry that is down to my lack of proper documentation, basically what gets returned from createLayer() is the Layer object rather than the visual group, just like createMap() returns the map object rather than the displayGroup (map.world) so you will want to change your insert code to this:

localGroup:insert( v1.group ) localGroup:insert( v2.group ) [import]uid: 5833 topic_id: 4422 reply_id: 16062[/import]

Hmm, I now have the problem of I can no longer access the world group.

“attempt to index field ‘world’”.

Using this with functions such as local tilePosition = ugni.screenToTilePosition( map, {x = pos.x + 11, y = pos.y} ). [import]uid: 13089 topic_id: 4422 reply_id: 16063[/import]