enemyship.java

来自「StarShip Battle 2004 game The Developing」· Java 代码 · 共 67 行

JAVA
67
字号
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;


/*
 * Represents the enemy ship sprite
 */
 
public class EnemyShip extends Sprite {
	private int dx = 0;
	private int dy = 1;
	
    /*
     * Creates an alien ship.
     */
    public EnemyShip(Image image) {
        super(image);
    }

    /**
     * Creates an alien ship with specified frame width and height.
     *
     * @param image the image
     * @param frameWidth sprite frame width
     * @param frameHeight sprite frame height
     */
    public EnemyShip(Image image, int frameWidth, int frameHeight) {
        super(image, frameWidth, frameHeight);
    }

    /**
     * Creates an alien ship from another Sprite.
     *
     * @param sprite the Sprite
     */
    public EnemyShip(Sprite sprite) {
        super(sprite);
    }
    
	/**
	 * @return Returns the dx.
	 */
	public int getDx() {
		return dx;
	}
	
	/**
	 * @param dx The dx to set.
	 */
	public void setDx(int dx) {
		this.dx = dx;
	}
	
	/**
	 * @return Returns the dy.
	 */
	public int getDy() {
		return dy;
	}
	
	/**
	 * @param dy The dy to set.
	 */
	public void setDy(int dy) {
		this.dy = dy;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?