1

if 语句是: //these x & y do not affect the if statement they are used for the result 6 lines down. int x = enemy.position.x; int y = enemy.position.y; NSLog(@"%G,%G", leftJoystick.velocity.x, leftJoystick.velocity.y);

if ((leftJoystick.stickPosition.x < 1 && leftJoystick.stickPosition.x > -1)&& leftJoystick.stickPosition.y > 0) {
    enemy.position = ccp(x,y-1);
    NSLog(@"North");
    return;
}

在反馈中,它显示-0.0544645,0.998516有效并且它记录北,但-0.0725357,0.997366不起作用。我不明白为什么?

我正在尝试在 cocos2d 中执行此操作。

4

1 回答 1

0

您正在记录速度,但您的逻辑在位置上运行。把它弄清楚,也许答案会更清楚。

于 2012-07-06T20:40:06.920 回答