Hi,
I created a level for my game. I am able to load the map, to call createVisual. That is working. But when I call createTileLayer it doesn't.
Am I the only only having this problem ?
BR
Bruno
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Hi,
I created a level for my game. I am able to load the map, to call createVisual. That is working. But when I call createTileLayer it doesn't.
Am I the only only having this problem ?
BR
Bruno
The "createTileLayer" function is only for when you require to load a single specific layer, for most situations you won't need to use it.
You should be fine with just:
1 2 | local map = lime.loadMap( "map.tmx" ) lime.createVisual( map ) |
In fact I have game levels with 4 layers. On layer 1 and 2 I have static items. On layer 3 I have moving items driven by the game engine and on layer 4 I have static items. The aim of the fourth layer is to hide the moving items on some portions of the screen. So how do I do to access the display group corresponding to the third layer ?
I also have another question. I was playing with the tutorial about properties and I don't understand why I need to create a visual of the map to access the properties associated with the tiles.
Thanks.
BR
Bruno
To get the visual of a certain layer you can do this:
1 2 | local layer = map:getTileLayer( "layerName" ) local visual = layer:getVisual() |
Ok. Thanks. I am going to have a look.
Bruno
It is working except for the properties :
If I put that :
1 2 3 4 5 6 7 8 9 10 | local layer = map:getTileLayer ( "StaticItems" ) ; local list = layer:getTilesWithProperty ( "Type" ) ; if list == nil then print ( "Number of items = 0" ) ; else print ( "Number of items = "..#list ) ; end -- Create the visual local visual = Lime.createVisual ( map ) ; |
Ok thanks, I will look into that. Out of curiosity, is there any reason you need to have properties before creating the visual?
I have two components : the GameEngine ( logic ) and the GraphicEngine ( graphics ). The GameEngine creates the GraphicEngine. I associate properties with the tiles ( such as Type=Obstacle ) so that I can build some kind of topography I will use with my PathFinding function.
Bruno
OK cool, I will see if I can get the properties accessible before visual is created for the next version.
Hi,
just to tell you I found a workaround :
_ I create the visual in my GameEngine but set the property isVisible to false.
_ Get all the properties to build the logic representation of the world.
_ Pass the map to my GraphicEngine.
_ Call getVisual function on the map and then set the isVisible property to true.
Et voila.
BR
Bruno from http://blueglutton.com
Thank you for keeping me up to speed, I hope to have the issue solved for the next version so you won't need to use the workaround but good to know just in case :-)
You're welcome.
Bruno from http://BlueGlutton.com