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.
精彩评论