⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enemyplane.java~3~

📁 一款益智类的手机游戏
💻 JAVA~3~
字号:
package twplanegame;

import javax.microedition.lcdui.*;

class EnemyPlane
    extends PlaneGameObject
{
    private int XSpeed = LSpeed; //Speed
    private int YSpeed = LSpeed; //
    private int Direct = UP; // 方向 up 0;right 1;down 2;left 3
    private int FlyType = 0; // 飞行轨迹 0 直线; 1 抛物线 ;2 S形

    //constructor
    public EnemyPlane()
    {
        super(1, 0, 0);
        try {
            ObjImage = Image.createImage("/e_plane0.png");
        }
        catch (Exception e) {
            ObjImage = null;
        }
        int width = ObjImage.getWidth();
        int height = ObjImage.getHeight();
        int radius = width < height ? width : height;
        SetImageSize(width, height, radius);
    }

    public void SetValue(int id) //set charactor values for enemy plane
    {
        SetID(id);
        SetState(ALIVE);
        switch (id) {
            case 1: //enimy plane type 1
                SetHP(1);
                SetSpeed(LSpeed, LSpeed);
                FlyType = 1;
                break;
            case 2: //enimy plane type 2
                SetHP(1);
                SetSpeed(LSpeed, LSpeed);
                FlyType = 2;
                break;
            case 3: //enimy plane type 3
                SetHP(1);
                SetSpeed(LSpeed, LSpeed);
                FlyType = 3;
                break;
        }
    }

    public int getXSpeed()
    {
        return XSpeed;
    }

    public int getYSpeed()
    {
        return YSpeed;
    }

    public void SetSpeed(int xs, int ys)
    {
        XSpeed = xs;
        YSpeed = ys;
    }

    public int getDirect()
    {
        return Direct;
    }

    public int getFlyType()
    {
        return FlyType;
    }

    public int SetFlyType(int t)
    {
        return FlyType = t;
    }

}

⌨️ 快捷键说明

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