sprite animation in chipmunk

Official forum for the Chipmunk2D Physics Library.
Post Reply
Komal Shah
Posts: 1
Joined: Mon Apr 22, 2013 7:17 am
Contact:

sprite animation in chipmunk

Post by Komal Shah »

Hello,
I have maid sprite by joining different parts of it in chipmunk,now i want to put some animation like walk,jump on it,how it is possible? Chipmunk don't support ccmoveto function
I have made dollcharacter & dollsprite two different files in dollsprite.h i have define nsobject which contain head,torso,arm,leg all the parts, in dollsprite.m i have taken batchnode & in dollcharacter file i have define body size,shape & join them.

Now i want to put some colliders in path but i don't know how to detect collision with this different body parts?
i want to put effects like if character collide with its leg then fall in different manner and when collide it's torso with colliders than fall in different manner



please tell me how to do this task?
cpbodyapplyforce option also used for applying force but where i have to put it to make my sprite walk
i want to put linear force to make sprite walk
please help
if u can post the code than it will be better for me
thank you
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: sprite animation in chipmunk

Post by slembcke »

So it's more complicated with a physics engine than just a sprite engine. The sprite engine only cares about the position it should draw the sprites at. In order to make things collide correctly, a physics engine also needs to know the velocity of the objects and usually how much force is driving them as well. Another problem is that if you are setting the position and velocity of something every frame, it can't react to collisions.

Instead, you have to think about what forces cause things to move the way you want them to. I made a platformer game for a contest a couple years ago using Chipmunk that should be useful, particularly the Character class.
https://github.com/maximile/Your-Story
https://github.com/maximile/Your-Story/ ... haracter.m

It uses Chipmunk's surface velocity feature to make the player walk, and makes the player jump by applying an upwards impulse and additional force while in the air.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests