How to create a body for a spritesheet

General discussion about the R.U.B.E editor
Post Reply
skinwalker
Posts: 14
Joined: Sat Jun 21, 2014 1:19 pm

How to create a body for a spritesheet

Post by skinwalker »

Hello iforce2d,
I have recently started developing my runner game and I have some questions :

1.Is this body good for my character?
It has 20 different animations in this spritesheet I just took the largest one to make the body.

Image

2.How can I switch the bodies when I switch from running to crawling animation?


3.How can i jump and catch the edge of the terrain (to go up)?
Example here :
Image
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: How to create a body for a spritesheet

Post by iforce2d »

1. I don't think you need so many bodies. Do they all have some important function in your game? Would the user notice if there was only one body?

2. As above, I would start by just using one body. If you really need to have different shape fixtures for different directions of movement, you could have two sets of fixtures present all the time, and just turn some of them off and on by changing their collision filter settings, so that some of them will have no collision response when facing left etc.

3. Very very complex question :D Sorry, I have no idea.
skinwalker
Posts: 14
Joined: Sat Jun 21, 2014 1:19 pm

Re: How to create a body for a spritesheet

Post by skinwalker »

1.There is only one body with 8 fixtures to make the collision better or not?
I think this is better than just 1 circle body, what do you think?
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: How to create a body for a spritesheet

Post by iforce2d »

1. I would start even simpler than that - for example, one body with one fixture... could your game be played effectively like that?

I guess you are taking inspiration from the Limbo game, which looks like it has a fully articulated player body, at least when the player dies. But when the player is not dead, I'm not so sure it is using so many bodies at all.
skinwalker
Posts: 14
Joined: Sat Jun 21, 2014 1:19 pm

Re: How to create a body for a spritesheet

Post by skinwalker »

I am not sure if you are talking about this when you told me to use just 1 body with 1 fixture
If yes, what happens with the space colored in red, I think this can't make a good collision with walls/platforms
Image

Merry Christmas !
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: How to create a body for a spritesheet

Post by iforce2d »

Okay, so the answer to my question would be "no". How about two fixtures then, or three? The point is, you don't need to have anywhere near as many fixtures as needed to match the graphics display.

If it helps, here's my best guess at how Limbo is done. There is a main body that has pretty basic fixture(s), maybe two circles etc, and a bunch of sensors to detect when the player is touching something he can push, something he can climb, a trap, water, the edge of a ledge etc. When touching one of these things the images could either be played in a loop for the appropriate animation, or probably more likely, they are manipulating the endpoints of the hands/feet to perform actions, and the arm/leg segments are very light bodies which simply follow along in between. When the player dies, everything is switched to ragdoll.

You could always ask the Limbo developers for some info, they might be happy to share.
Post Reply