How to rotate truck image used in CCSprite on touch in iOS objective c?

36 Views Asked by At

we are trying to update old maze game in iOS objective-c I don't know any thing about sprite(games) used in iOS. I am trying to do hit n trial to move truck in maze game, Truck image is used in CCsprite,So how to rotate truck image used in CCSprite on touch to every position.

_player = [CCSprite spriteWithFile:@"trolley_ipad.png"];


- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{

}
1

There are 1 best solutions below

0
shallowThought On

You set an (anchor) point to rotate around:

_player.anchorPoint = cpp(anchorX, anchorY);

and rotate it:

_player.rotation = 90;