I am developing a jump game, in that when tapped on screen, I need to make the player jump up. So, I used following code.
[_player.physicsBody applyImpulse: ccp(0, player.physicsBody.mass * 155)];
in touchBegan method.
The code for CCSprite *_player is
_player = [CCSprite spriteWithImageNamed: @"Assets.atlas/Player.png"];
[_player setPosition: ccp(160.0f, 210.0f)];
_player.zOrder = 99;
_player.physicsBody = [CCPhysicsBody bodyWithRect:(CGRect){CGPointZero, _player.contentSize} cornerRadius:0]; // 1
_player.physicsBody.collisionGroup = @"playerGroup"; // 2
_player.physicsBody.collisionType = @"player";
//[_physicsWorld addChild:_player];
[_foreground addChild: _player];
This code explains that the player is setup with physics body and added into some _foreground view. The issue is with applyImpulse method written in touchBegan. When it makes player to jump, the player jumps slowly, I want it to make somewhat faster, like, jumping hulk, start speedily and end slowly. How can we manage this without using animation? Because applyImpulse will not allow to use animation, I think.
Please help me on the topic, any suggestion, hint, anything that I can use?