package com.tarena.fly;

/**
 * 子弹类:是飞行物
 */
public class Bullet extends FlyingObject {
	private int xspeed = 1;
	private int yspeed = 1;
	private static int x2;
	private static int y2;
	//移动的速度
	
	/** 初始化数据 */
	public Bullet(int x,int y){
		this.x = x;
		this.y = y;
		this.image = ShootGame.bullet;
	}

	public static void moveTo(int x1,int y1){
		
		x2 = x1;
		y2 = y1;
		
	}
	
	  
	/** 移动 */
	@Override
	public void step(){   
		y-=yspeed*4;
		if(x2>this.x)
		x-=xspeed;
		
		if(x2<this.x){
	    int xspeed = -1;
	    x-=xspeed;
		}
		
		
	}

	/** 越界处理 */
	@Override
	public boolean outOfBounds() {
		return y<-height;
	
	}
	public boolean outOfBounds1() {
		return x>ShootGame.WIDTH;
		
	}
	public boolean outOfBounds2() {
		return x<-width;
	
	}
}
