I'm wanting to do a tongue effect for my character like the one in Munch Time( shown in pic ). The player does some action and his tongue attaches to the nearest platform.
I'm thinking this is simply a get distance to platform and keep player at that distance as he moves back and forth giving him the swinging effect.
For the drawing, I'm wanting the same effect where the tongue sprite is the skinniest in the middle of the distance between the character and platform.
I know how to do this in a shader( I'm using cocos2d v2 btw ), but I'm wondering if there is some built-in functionality to allow me to do this.
First, is this the right approach using distance?
Second, is their an easy way to do the tongue sprite effect without a shader?
Third, I'm wanting to have the player spring up at will in the direction of the platform. I'm using Box2D. Would there be a way to do this using force's or would it be easier to write my own code?
Answer
If I were you I wouldn't use a physics engine, take a look at the maths for a pendulum motion:
http://en.wikipedia.org/wiki/Pendulum
It'll give you a much more natural looking swinging motion than just keeping him a certain distance from the platform as you'll be taking into account velocity.
Would it not be easier to draw a shape from the centre of the player to the platform, then bind a texture on that shape (like the texture on the tongue).
If you take the current speed and direction of the player I'm sure you'll be able to make it spring up in the right direction.
No comments:
Post a Comment