Tile as static body?

I was trying to change the config tutorial such that I would associated a tile with a Corona static physics body thru a config file, but I cannot make it work…

I essentially added the property entry

configFile ground.json

to one of the tiles, but thats didn’t seem to have any effect.

Then I tried to add the property entries explicitly:

type Body
bodyType static

but that didn’t work either.

Then I looked at the other tutorials, but I couldn’t see any tiles being used as static-bodies - only objects.

Am I doing something wrong?

Thanks, Frank.

[import]uid: 8093 topic_id: 6633 reply_id: 306633[/import]

Could you post your json code? I have static bodies working through json and by directly setting lroperties [import]uid: 8782 topic_id: 6633 reply_id: 23115[/import]

I’m using the exact same json file (ground.json) from the config tutorial:

{  
 "type":"Body",  
 "bodyType":"static"  
}  

and added the configFile property with value ground.json to one of the tiles in the hope that it was an easy way to create a physical wall/brick. Unfortunately that doesn’t seem to work as the little mario runs straight thru it :wink:

-FS.
[import]uid: 8093 topic_id: 6633 reply_id: 23125[/import]

You need to have
[lua]{
“HasBody”:"",
“bodyType”:“static”
}[/lua]
hope that helps. I’m on an iPod typing this, or I would write more. :slight_smile: [import]uid: 8782 topic_id: 6633 reply_id: 23136[/import]

That works!

Guess there is a slight difference between the physics-properties for objects and tiles… not sure if that is documented - I may have missed it…

Thanks for the help.

-Frank.
[import]uid: 8093 topic_id: 6633 reply_id: 23138[/import]

Hi Frank, yea there is a slight difference in the creation of Physics bodies from Tiles or Objects, basically the Objects have a Type property so it is set to “Body” whereas the Tiles don’t have that so they are set to “HasBody”. If you think of it like the Objects ARE physics bodies whereas the Tiles HAVE physics bodies (as well as the visual) it may help.

And thank you very much Robert for beating me to it :slight_smile: [import]uid: 5833 topic_id: 6633 reply_id: 23210[/import]

Not sure if I adhere to this elegant and natural-language semantically correct world view… you may have to jump thru an additional hoop to explain how you’re supporting tile-objects :wink:

From a pragmatic view, it would be nice to reuse the same config file settings for objects/tiles/tile-objects…

Being even more pragmatic, I believe that by adding both “type”:“Body” and “HasBody”:"" property entries to a config file will make it work for both buggers.

-FS.
[import]uid: 8093 topic_id: 6633 reply_id: 23255[/import]

Currently the config files are passed as is to Lime which is so that if any new physics or visual properties got added to Corona Lime would be able to deal with them without me adding any updates (meaning it’s quicker for you guys) however I would not be totally against allowing both properties to work in Lime and thus in config files. [import]uid: 5833 topic_id: 6633 reply_id: 23441[/import]