Rotating stars like Cut the Rope - cocos2d-iphone

I am working on cocos2d-iPhone. I want to rotate stars with respect to its y Axis like it is in CUT THE ROPE game. I know we can rotate star to its x axis simply by ccRotateto action. Here is the link of CUT THE ROPE GAME.
http://www.youtube.com/watch?v=qoYJMaGPas4
In this link all the stars are rotating at its Y axis. You can see that in first star as it is steady.
Anyone has any idea how can we implement this??

Cocos2D has the CCOrbitCamera action that might work for you:
[[CCDirector sharedDirector] setProjection:kCCDirectorProjection3D];
CCOrbitCamera *orbit = [CCOrbitCamera actionWithDuration:1.0f radius:1 deltaRadius:0 angleZ:0 deltaAngleZ:360 angleX:0 deltaAngleX:0];
[mySprite runAction: orbit];
You can modify the angles to get the effect you're looking for.

that is done by animation frames. you need to have the rotation animation frames and you can run animation with frames to get that effect.

Related

How to get the current angle of a sprite in Cocos2d v3

I am wanting to move a sprite in the the direction it is facing. I got everything I need except the sprites current angle. It is rotating back and forth like a pendulum forever, but when the button that moves it is tapped it stops rotating and moves in the direction it is currently facing, or at least thats what I want it to do, but I don't know how to get the value for the current angle. Could someone help me out? =)

Rocket like movement in cocos 2d V3 with chipmunk

On tapping on screen I`m gonna apply impulse and angular rotation to sprite to move it to the sides. But after some time OR parameters of physics body attached to sprite should go back to initial (impulse 0, angular speed = 0). What are the best ways to do that (use CCAction or on update detect parameters of physics body and change them to initial)?
If i were in your position, I would probably start a timer at the first collision of the sprite and then use a CCAction to transition to the initial state to make it look smooth. Don't know if its the best way though.

Bending a CCSprite by Skewing it from various points like in photoshop

Hi I am Using Cocos2d with Box2d.
I have a "Stick.png" as CCSprite Now I want to bend it from center downwards and Upwards from the end and start of image.. I am trying to make game like hill Climb that is using only one Green image of a grass strip for the whole vehicle Path/Road used in the game.
I shall be thankful.
Please Help
You can use the skewX skewY properties to achieve this effect. There are also CCSkewBy and CCSkewTo actions to animate skewing.

How to rotate image or sprite along X or Y axis in Cocos2d, Objective-c, or in a popular or free mac image editor?

If you visit the following link, it may be easier to understand what I am trying to accomplish:
http://blog.flexexamples.com/2008/08/02/rotating-an-image-along-its-x-axis-y-axis-and-z-axis-in-flex-and-flash-player-10/
In cocos2d it is easy to rotate an image along the z-axis. What I am trying to do is rotate along the X or Y axis as illustrated in the link (if you slide the sliders of rotationX or rotationY).
Being able to do this programmatically in cocos2d would be ideal, but if I could even do this in a free or low-cost mac image editor it would solve my problem, as I could then save the images and just animate them in cocos2d.
Found the answer:
CCFiniteAction* foo = [CCActionTween actionWithDuration:1.0 key:#"scaleX" from:1.0 to:-1/0];
[sprite runAction:foo];
You can also flip along "x" axis by using "scaleY" instead of scaleX
You can modify the camera property of the CCSprite to change the 3-dimensional orientation of the sprite.

Running an animation on a CCSprite

How does one run an animation or a series of pngs(e.g. 4 pngs) on a CCSprite?
Constantly make the CCSprites image be this animation series?
Also, how does one rotate a CCSprite's orientation? e.g. 45 degrees rotation to the left or right
Thanks
Yes, you want to update the sprite's source every so often according to a timer.
For rotating, check out this tutorial: http://www.raywenderlich.com/692/rotating-turrets