Trying to do a simple Jump
<p>I'm trying to learn how to make a 2D Game without Game Engines, anyways I already created a background scrolling right now my goal is to make my character jump. But the thing is whenever I start my app the character is spinning up and down and it will just go away to the background. </p>

<p>Here's my character code</p>

<pre><code>public class Deer extends GameCharacter {

private Bitmap spritesheet;
private double dya;
private boolean playing;
private long startTime;
private boolean Jump;
private Animate Animation = new Animate();

public Deer(Bitmap res, int w, int h, int numFrames) {

    x = 20;
    y = 400;
    dy = 0;
    height = h;
    width = w;

    Bitmap[] image = new Bitmap[numFrames];
    spritesheet = res;

    for (int i = 0; i &lt; image.length; i++)
    {
        image[i] = Bitmap.createBitmap(spritesheet, i*width, 0, width, height);
    }

    Animation.setFrames(image);
    Animation.setDelay(10);
    startTime = System.nanoTime();

}

public void setJump(boolean b){
    Jump = b;
}

public void update()
{
    long elapsed = (System.nanoTime()-startTime)/1000000;
    if(elapsed&gt;100)
    {
    }
    Animation.update();

    if(Jump){
        dy = (int)(dya+=5.5);

    }
    else{
        dy = (int)(dya+=5.5);
    }

    if(dy&gt;14)dy = 14;
    if(dy&gt;14)dy = -14;

    y += dy*2;
    dy = 0;
}


public void draw(Canvas canvas)
{
    canvas.drawBitmap(Animation.getImage(),x,y,null);
}
public boolean getPlaying(){return playing;}
public void setPlaying(boolean b){playing = b;}
public void resetDYA(){dya = 0;}
}
</code></pre>

<p>x - character's horizontal position
y - character's vertical position
dx - character's horizontal acceleration
dy - character's vertical acceleration</p>

<pre><code>   public boolean onTouchEvent(MotionEvent event) {
      if(event.getAction()==MotionEvent.ACTION_DOWN) {
        if(!deer.getPlaying()) {
            deer.setPlaying(true);
        }
        deer.setJump(true);
        return true;
    }

    return super.onTouchEvent(event);
}
</code></pre>