开发者

How do you return from a method?

I have this call: (Velocity is a CGPoint)

float velY = Velocity.y;
velY = [self DoJump:velY :gT];

To this:

- (float) DoJump:(float) velo开发者_如何学CcityY:(ccTime) GameTime
{

   return velocityY;
}

but im getting an error at the call saying incompatible types. Can someone tell me what is wrong?


I don't know what you pass to the function, but your definition looks wrong. It should be more like:

- (float) DoJump:(float)velocityY andTime:(ccTime) GameTime

and then you call it with

velY = [self DoJump:velY andTime:gT];

Make sure to pass float and ccTime types to the method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜