Creating platformer level with physics using Tiled

Hi guys! I want to create platformer level using Tiled. Okey, here we importing in Tiled an image (sheet with tiles), drawing our level with ground, water, platforms. 

We have pieces in our tileset to make our platforms wider and shorter assembling them with corner/center/transit tiles. And now we need physics! So we adding «bodyType = string static» + «bounce float / friction float» custom properties to our layer, exporting, starting and …nothing works. 

In hybrid mode we can see no platforms physics added from map. Why? As I understand by adding in Tiled layer custom properties we can simply make every tile for example static rectangle physics body.

Hmmm, maybe physics added by Tiled works ONLY for OBJECTS in ponywolf plugin? Seems that isn’t true because this way you will not be able to create thousands of various platforms on the fly but only few types with predefined shape by assembling each platform from tiles in a single image of an object.

Here is a link where this is realized and working

https://www.youtube.com/watch?v=AAAtDCegMBc&t=26s

I tried same and got nothing. Can someone show me what I’m doing wrong? This is very good idea to implement physics from map file and it will be so sad to code my own level editor from begining while there is a good one )

And the second question is: how about physics for non-rectangular tiles?

image.png

What tiled helper library are you using?

Need name and ideally link to library you’re using so we know where you got it and so we can look at it too.

Ah, I see… my bad.  You’re using Ponywolf’s lib.

I think you have to do the heavy lifting for physics on your own,  that said I’m looking at the lib and will post back if I’m wrong.

So, I may be wrong about that too.   I see he has some properties you can set to get a body attached to objects.

My suggestion here is that you add your own print output to ponytiled.lua and see what it is doing.  i.e. Instrument the code and work out what bits are running and which bits are not.

I did try to run your example but was unable to, so I stopped there for now.

I’ll circle back when time permits.

Yes, I’m using ponytiled library. And I have fixed this already by creating in Tiled polygon objects with alpha =0,01 property.

And I have some troubles with it: ball is moving infinitely even with friction. Example attached.

And I do not understand this :frowning:

Hi @zombiexp2010,

I have fixed your map from first zip project using my Berry module. See file below.

Berry support:

  • Inheritance custom properties (inlcuding physical properties) from tile and object layers by tile and object,
  • Polygon and rectangle collision shapes.

ldurniat

What tiled helper library are you using?

Need name and ideally link to library you’re using so we know where you got it and so we can look at it too.

Ah, I see… my bad.  You’re using Ponywolf’s lib.

I think you have to do the heavy lifting for physics on your own,  that said I’m looking at the lib and will post back if I’m wrong.

So, I may be wrong about that too.   I see he has some properties you can set to get a body attached to objects.

My suggestion here is that you add your own print output to ponytiled.lua and see what it is doing.  i.e. Instrument the code and work out what bits are running and which bits are not.

I did try to run your example but was unable to, so I stopped there for now.

I’ll circle back when time permits.

Yes, I’m using ponytiled library. And I have fixed this already by creating in Tiled polygon objects with alpha =0,01 property.

And I have some troubles with it: ball is moving infinitely even with friction. Example attached.

And I do not understand this :frowning:

Hi @zombiexp2010,

I have fixed your map from first zip project using my Berry module. See file below.

Berry support:

  • Inheritance custom properties (inlcuding physical properties) from tile and object layers by tile and object,
  • Polygon and rectangle collision shapes.

ldurniat