I am trying to bounce a ball in an android project using the libGDX game engine.
ball = new Texture("football.jpg");
batch = new SpriteBatch();
sprite = new Sprite(ball);
render(float delta)
{
batch.begin();
sprite.draw(batch);
batch.end();
stage.draw();
jumpUp(); //here i call the jump function..
}
The jump function looks like this:
public void jumpUp()
{
sprite.setY(sprite.getY()+2);
dem=sprite.getY();
if(dem==100.0f)
{
jumpDown();
}
}
public void jumpDown()
{
sprite.setY(sprite.getY()-1);
}
The ball is actually moving upward but it's not coming down again.
Should I also call jumpDown() in the render() method?