1 decade ago by fulvio
I was just having a look through the Physics Box2D demo provided and came across this code for the Jetpack/Jump input:
If I'm not using Box2D and I just want to use the Jump n' Run demo to create my platformer. What would be the best way to create a jetpack effect?
At the moment this is my jetpack code:
It works very similar, but it's still a little flakey. Is there a better way to implement this type of functionality?
if (ig.input.state('jump')) { this.body.ApplyForce(new b2.Vec2(0, -30), this.body.GetPosition()); }
If I'm not using Box2D and I just want to use the Jump n' Run demo to create my platformer. What would be the best way to create a jetpack effect?
At the moment this is my jetpack code:
if (ig.input.state('jetpack')) { var f = Math.max(0, ig.system.tick); this.vel.y -= this.jump * f * 3.5; }
It works very similar, but it's still a little flakey. Is there a better way to implement this type of functionality?