나는 Cocos2D 및 Kobold2D를 사용하여 게임을 만들고 있습니다. 내가가 예상대로CCMoveTo 인해 점프
KKInput * input = [KKInput sharedInput];
CGPoint tap = [input locationOfAnyTouchInPhase:KKTouchPhaseBegan];
if (tap.x != 0 && tap.y != 0)
{
[ship stopAllActions]; // Nullifies previous actions
int addedx = tap.x - ship.position.x;
int addedy = tap.y - ship.position.y;
int squaredx = pow(addedx, 2);
int squaredy = pow(addedy, 2);
int addedSquares = squaredx + squaredy;
int distance = pow(addedSquares, 0.5);
[ship runAction: [CCMoveTo actionWithDuration:distance/100 position:tap]];//makes ship move at a constant speed
}
배는 일반적으로 이동 : 내 게임에서, 나는이 코드를 사용하여, 플레이어가 탭 곳으로 이동하려는 배를 가지고있다. 그러나, 내가 탭 위치로 부드럽게 움직이는 대신 배 근처에서 탭하면 그 위치로 점프합니다. 이 문제를 어떻게 해결할 수 있습니까?
이있다. – Renaissance