coco2d虚拟摇杆CCJoyStick

项目地址:
http://code.google.com/p/ccjoystick/

sample code:

myjoysitck=[CCJoyStick initWithBallRadius:25 MoveAreaRadius:65 isFollowTouch:NO isCanVisible:YES isAutoHide:NO hasAnimation:YES];//球体半径,球体移动区域半径,是否跟随触点移动,是否可见,是否自动隐藏,是否具有动画效果
[myjoysitck setBallTexture:@"Ball.png"];//可选,不设置贴图一样可用
[myjoysitck setDockTexture:@"Dock.png"];//可选,不设置贴图一样可用
[myjoysitck setStickTexture:@"Stick.jpg"];//可选,不设置贴图一样可用
[myjoysitck setHitAreaWithRadius:100];//设置以position为圆心的圆形激活区域,还可以设置[myjoysitck setHitAreaWithRect:];设置屏幕某一区域为激活区域
myjoysitck.position=ccp(100,100);
myjoysitck.delegate=self;
[self addChild:myjoysitck];

then … 

- (void) onCCJoyStickUpdate:(CCNode*)sender Angle:(float)angle Direction:(CGPoint)direction Power:(float)power
{
}

very easy very useful!

你可能感兴趣的:(coco2d虚拟摇杆CCJoyStick)