开发者

How do you return from a method?

开发者 https://www.devze.com 2023-01-08 23:38 出处:网络
I have this call: (Velocity is a CGPoint) float velY = Velocity.y; velY = [self DoJump:velY :gT]; To this:

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

精彩评论

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