This is the code running my sprite, it's supposed to jump smoothly and start from the center of the screen. Which it does, occasionally, but most of the time it crashes down to the floor. It still jumps, but it's not smooth.
Float value
@interface HelloWorldScene () <CCPhysicsCollisionDelegate>
{
float _yVel;
}
@end
Math
- (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);
}
Can someone help with this?