HUD层中的操纵杆

时间:2012-10-03 10:08:47

标签: joystick hud

我想给HUD提供操纵杆。

我的HUD文件:

myJoystick = [CCJoyStick initWithBallRadius: 25 MoveAreaRadius: 65 isFollowTouch: NO isCanVisible: YES isAutoHide: NO hasAnimation: YES];
         [myJoystick setBallTexture: @ "joystick_control.png"];
         [myJoystick setDockTexture: @ "joystick_lid.png"];
         [myJoystick setHitAreaWithRadius: 100];
        
         myJoystick.position = ccp (100,100);
         myJoystick.scale = 0.3;
         myJoystick.delegate = self;
         [self addChild: myJoystick of: 5];

并在HelloWorldLayer中:

(Void) onCCJoyStickUpdate (CCNode *) sender Angle: (float) Angle Direction: (CGPoint) direction Power: (float) power {
     if (sender == myJoystick) {
         spider2.rotation =-angle;
         ...

找不到myJoystick。 我该如何解决这个问题?

这是我的代码: Link

0 个答案:

没有答案