2010-11-27 9 views

답변

1

속도는 거리를 시간으로 나눈 값으로 정의됩니다. 따라서 주어진 시간 내에 경과 된 시간만큼 스프라이트를 이동 한 픽셀을 나눕니다.

+0

에 대한 속도를 계산 샘플 예는? – cocos2dbeginner

1
CGPoint diff = ccpSub(new_location, oldTouchLocation); 
CGPoint currentpos = [para6 position]; 
CGPoint destination = ccpAdd(currentpos, diff); 
if (destination.x < 80 && destination.x > 20) 
{ 
Velocity = (20 + (80-destination.x))*1.8 ; 
} 

위는 예를하시기 바랍니다 할 수 있습니다 내 플런저

관련 문제