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 中执行此操作。