ios - applyImpulse on CCSprite not making realistic moves, need to speed up the sprite moves -
ios - applyImpulse on CCSprite not making realistic moves, need to speed up the sprite moves -
i developing jump game, in when tapped on screen, need create player jump up. so, used next code.
[_player.physicsbody applyimpulse: ccp(0, player.physicsbody.mass * 155)];
in touchbegan method.
the code 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 player setup physics body , added _foreground view. issue applyimpulse method written in touchbegan. when makes player jump, player jumps slowly, want create faster, like, jumping hulk, start speedily , end slowly. how can manage without using animation? because applyimpulse not allow utilize animation, think.
please help me on topic, suggestion, hint, can use?
ios cocos2d-iphone game-physics ccsprite cocos2d-iphone-3
Comments
Post a Comment