I am using Cocos2d3.x with SpriteBuilder in Swift.
I want to make the animation like a bouncing ball in polls, as shown in this GIF: https://www.dropbox.com/s/43vwlbjoazaxe7u/jumpyBall_15_jul_15.gif?dl=0
If you notice in the GIF file, every second jump is half the previous jump. So it looks like 1,0,5,1,0,5,1,0,5, ...
Below are my settings:
Surveys:
Physics Enabled Density: 1.0 Static Body Collision Type: Platform
Circle:
Physics Enabled Density: 1.0 Dynamic Body Collision: hero Affected by gravity
MainScene:
func ccPhysicsCollisionBegin(pair: CCPhysicsCollisionPair!, hero: Player!, platform: Obstacle!) -> Bool { hero.physicsBody.applyImpulse(ccp(0, distanceObst)); }
distanceObst is the distance between polls of 160.
Can someone give me suggestions on what I should do to make jumping uniform for every bounce? And I also want to speed up the races of the players, so is there any simplest way or formula or something else?
source share