Platformer Sprite Physics

Hello All,

So, I’ve been attempting to create a platformer-based game and have got stuck at the sprite animation stage.

So I have a spritesheet with various actions/states modelled (running, walking, jumping, idle etc.) but I’m having trouble working out how best to model the related physics body to it.

Since all my sprites have various shapes and sizes, I wanted to setup a basic outline applicable to all (using 3 circles of varying sizes for the main sprite shape) and also providing 4 additional sensors (left/right hand, left/right foot for collision checks).

I first tried using PhysicsEditor, and the export I get doesn’t include any shape information, since the fixtures are all circles.

From what I can work out, Corona doesn’t support the setting of an Anchor Point (instead it defaults to the x,y center of the display group the body is applied to). This means that all 7 of my fixtures are centered when it comes to running the game.

How have other people handled this, beyond creating the craziest known physics polygon shape to encompass the union of all sprite poses? Is it possible somehow to associate these circular fixtures and create an overall body from it? [import]uid: 122384 topic_id: 25876 reply_id: 325876[/import]

Do you have the latest version of PhysicsEd? He added “Fixture ID” retrieval so you can export and have one large lua file with all the fixtures in there.

The update is from about I think a few months back. I built all my “worlds” with phsyicsEd and had to extract the fixture id’s.

Before that, I was creating many lua files and requiring them all so I could get access to the physics data from autotrace.

Maybe cook up a sample of what you are doing and I can see if I can help out :slight_smile:

edit** oh, and you could also try spriteloq out as well. I watched a video of it in use, and it does not have auto trace features, but you can drag vertices points around to make the shapes. It packs sprites AND you can do phsyics editing in it. I haven’t bought it yet, as I asked about autotrace and he said not right now. That is the only reason I didn’t buy it and my worlds have 900+ vertices in them so that would take WAY to much time :slight_smile:
ng [import]uid: 61600 topic_id: 25876 reply_id: 104756[/import]

Thanks for the reply, but it’s the character sprite physics that I’m having trouble with.

Take for instance the following sprite-based animations: Walk, Run, Jump.

In terms of packing the sprites, TexturePacker has taken all the work out of it for me.

In terms of physics management however I’m a little bit lost. How can I ensure that the physics body of each animation type and frame shares a common set of fixtures.

I could auto-trace and use the union or intersection of the animation via PhysicsEditor, but really I wanted to construct my own set of circular fixtures that would allow me to have the same physics model for all sprites, to ensure consistency in the physical world.

In truth I can construct the sensors for left/right hands and left/right feet separately, but what I was expecting to be able to do was construct a body from say 3 circle fixtures and have that apply across all instances of my player sprite. Seems however that the circle fixture support in Corona is purely to wrap circular objects. [import]uid: 122384 topic_id: 25876 reply_id: 104847[/import]

I’ve just decided to go the route of using the basic rectangular physics shape for the player sprite and attaching additional physics bodies for hand and feet additional collisions (as sensors). [import]uid: 122384 topic_id: 25876 reply_id: 104867[/import]