0

I'm a beginner in Andengine (Started 1 week ago :D ) and I decided to follow the full game tutorial by matim-dev which you can find here : http://www.matim-dev.com/full-game-tutorial---part-1.html

Once finishing the tutorial, I wanted to change the way how the sprite jump, more faster. e.g : In this game the sprite takes 1 sec to go up and 1 sec to go down.

So my questions are : How can the sprite take 1 sec to up and down or less or even more or How can I handle the jump speed of a sprite in Andengine.

P.S : sorry for my bad english

Thank you !

Carried Louis
  • 47
  • 1
  • 6

1 Answers1

0

I haven't tested this, but I think it could work. You can increase the gravity of the world. This will make the player not jump as high as before. If you want him to jump to the same height but faster, you could increase the gravity and also increase the linear velocity when jumping.

The gravity is set when you create you physicsworld, in the example it is set to -17:

private void createPhysics()
{
physicsWorld = new FixedStepPhysicsWorld(60, new Vector2(0, -17), false); 
registerUpdateHandler(physicsWorld);
}

And changing the jump linear speed, in this example it is set to 12:

public void jump()
{
body.setLinearVelocity(new Vector2(body.getLinearVelocity().x, 12)); 
}