package Sprites;



/**
 * Created by sagi on 22/01/2016.
 */
public class Bird extends Sprite {


    private final int ACC = 10, MAX_ANGLE=45;

    public Bird(int xPosition, int pWidth, int pHeight, int size){
        super(xPosition, pHeight/2, pWidth, pHeight, 0, "birdSprite.png", 0 ,size, size);

    }

    //"pull" sprite down up to ACC speed
    @Override
    public void update() {
        if(acceleration > -ACC ) {
            acceleration--;
        }
        locY -= acceleration;
        if(angle <= MAX_ANGLE)
            angle += 5;
    }

    //bird "jumps" ACC pixels up, and img angle is set to MAX_ANGLE
    public void jump() {
        this.acceleration = 10;
        angle = -1*MAX_ANGLE;
    }

}
