0
這是運行我的精靈的代碼,它應該順利跳轉並從屏幕中心開始。它偶爾會這樣做,但大多數時候它會崩潰在地板上。它仍然跳躍,但不平穩。雪碧速度Cocos2d 3.0
浮點值
@interface HelloWorldScene() <CCPhysicsCollisionDelegate>
{
float _yVel;
}
@end
數學
- (void) jump
{
// adjust jump speed here
if (_player.position.y > kFLOOR_HEIGHT) _yVel -= 0.14;
else {
if (_yVel != 5) _yVel = 0;
}
_player.position = ccp(_player.position.x, _player.position.y + _yVel);
}
有人能幫助這一點?