【问题标题】:My sprite doesn't detect touch during its movement with CCAction我的精灵在使用 CCAction 移动时未检测到触摸
【发布时间】:2012-04-20 09:38:38
【问题描述】:

我的问题是:当我在特定位置创建一个精灵并使用CCActionMoveTo 时,我让它移动另一个位置。在移动过程中,精灵检测触摸事件。但是当我在移动过程中触摸我的精灵时它不起作用:

-(void)caca
{
    target = [CCSprite spriteWithFile:@"boulerouge_06.png"];
    target.position=(300,10);
    [self addChild:target];

    id actionMove = [CCMoveTo actionWithDuration:3 
                                        position:ccp(240, 160)];
    [target runAction:actionMove];
}

【问题讨论】:

    标签: iphone xcode cocos2d-iphone touch sprite


    【解决方案1】:

    精灵不检测触摸事件。您需要创建一个控制层,然后他们可以通过您的游戏层告诉您的精灵做其他事情。

    【讨论】:

    • 好的,有教程吗,或者你有一些代码来解释我更多请:)
    • 周围有很多 Cocos2D 教程。以 Ray Wenderlich 网站为例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多