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

📄 enemy.java

📁 j2me游戏都市骑士的代码,是一款横版格斗的游戏.可以学习参考.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                break;

            case 27: // '\033'
                switch(fr)
                {
                case 0: // '\0'
                    g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                    g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                    g.drawRegion(game.playerIm, 240, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
                    break;

                case 1: // '\001'
                    g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                    g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                    g.drawRegion(game.playerIm, 300, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
                    break;
                }
                g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                break;
            }
        else
        if(weapon == 33)
        {
            switch(face)
            {
            case 26: // '\032'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawImage(game.playerIm, (x + game.x1 + game.playerIm.getWidth() / 2) - 30 - 360, (y + game.playerIm.getHeight() / 2) - 30 - 60, 1 | 2);
                break;

            case 27: // '\033'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawRegion(game.playerIm, 360, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
                break;
            }
            g.setClip(0, 0, game.WIDTH, game.HEIGHT);
            if(System.currentTimeMillis() % 5L == 0L)
                ehit = false;
        }
    }

    public void drawEnemyJump(Graphics g)
    {
        switch(face)
        {
        case 26: // '\032'
            g.setClip((x - 30) + game.x1, y - 30, 60, 60);
            g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
            g.drawImage(game.playerIm, (x + game.x1 + game.playerIm.getWidth() / 2) - 30 - 120, (y + game.playerIm.getHeight() / 2) - 30 - 60, 1 | 2);
            break;

        case 27: // '\033'
            g.setClip((x - 30) + game.x1, y - 30, 60, 60);
            g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
            g.drawRegion(game.playerIm, 120, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

    public void drawEnemyStand(Graphics g)
    {
        if(!isWeapon)
        {
            switch(face)
            {
            case 26: // '\032'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawImage(game.playerIm, (x + game.x1 + game.playerIm.getWidth() / 2) - 30 - 120, (y + game.playerIm.getHeight() / 2) - 30 - 60, 1 | 2);
                break;

            case 27: // '\033'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawRegion(game.playerIm, 120, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
                break;
            }
            g.setClip(0, 0, game.WIDTH, game.HEIGHT);
        } else
        {
            switch(weapon)
            {
            default:
                break;

            case 39: // '\''
                switch(face)
                {
                case 26: // '\032'
                    g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                    g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                    g.drawRegion(game.axeIm, 256, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                    break;

                case 27: // '\033'
                    g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                    g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                    g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 256, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                    break;
                }
                g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                break;

            case 41: // ')'
                switch(face)
                {
                case 27: // '\033'
                    g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                    g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                    g.drawRegion(game.chainIm, 272, 64, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                    break;

                case 26: // '\032'
                    g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                    g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                    g.drawImage(game.chainIm, (((x + game.x1) - 34) + game.chainIm.getWidth() / 2) - 272, ((y - 32) + game.chainIm.getHeight() / 2) - 64, 1 | 2);
                    break;
                }
                g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                break;
            }
        }
    }

    public void drawEnemyWalk(Graphics g)
    {
        switch(fr)
        {
        default:
            break;

        case 0: // '\0'
            switch(face)
            {
            case 26: // '\032'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawImage(game.playerIm, (x + game.x1 + game.playerIm.getWidth() / 2) - 30, (y + game.playerIm.getHeight() / 2) - 30 - 60, 1 | 2);
                break;

            case 27: // '\033'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawRegion(game.playerIm, 0, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
                break;
            }
            g.setClip(0, 0, game.WIDTH, game.HEIGHT);
            break;

        case 1: // '\001'
            switch(face)
            {
            case 26: // '\032'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawImage(game.playerIm, (x + game.x1 + game.playerIm.getWidth() / 2) - 30 - 60, (y + game.playerIm.getHeight() / 2) - 30 - 60, 1 | 2);
                break;

            case 27: // '\033'
                g.setClip((x - 30) + game.x1, y - 30, 60, 60);
                g.clipRect((x - 30) + game.x1, y - 30, 60, 60);
                g.drawRegion(game.playerIm, 60, 60, 60, 60, 2, (x - 30) + game.x1, y - 30, 0x10 | 4);
                break;
            }
            g.setClip(0, 0, game.WIDTH, game.HEIGHT);
            break;
        }
    }

    public void enemyAxeJump(Graphics g)
    {
        switch(face)
        {
        case 26: // '\032'
            x -= 2;
            g.setClip((x - 32) + game.x1, y - 36, 64, 72);
            g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
            g.drawRegion(game.axeIm, 0, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
            break;

        case 27: // '\033'
            x += 2;
            g.setClip((x - 32) + game.x1, y - 36, 64, 72);
            g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
            g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 0, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

    public void enemyAxeWalk(Graphics g)
    {
        switch(face)
        {
        default:
            break;

        case 26: // '\032'
            switch(fr)
            {
            case 1: // '\001'
                g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                g.drawRegion(game.axeIm, 0, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                break;

            case 0: // '\0'
                g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                g.drawRegion(game.axeIm, 256, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                break;
            }
            break;

        case 27: // '\033'
            switch(fr)
            {
            case 1: // '\001'
                g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 0, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                break;

            case 0: // '\0'
                g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 256, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                break;
            }
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

    public void drawAxeFight(Graphics g)
    {
        if(weapon == 39)
            if(action == 15)
                switch(face)
                {
                case 27: // '\033'
                    switch(fr)
                    {
                    case 0: // '\0'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 64, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                        break;

                    case 1: // '\001'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 128, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                        break;

                    case 2: // '\002'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 192, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;

                case 26: // '\032'
                    switch(fr)
                    {
                    case 0: // '\0'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawRegion(game.axeIm, 64, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                        break;

                    case 1: // '\001'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawRegion(game.axeIm, 128, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                        break;

                    case 2: // '\002'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawRegion(game.axeIm, 192, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;
                }
            else
            if(action == 17)
                switch(face)
                {
                default:
                    break;

                case 26: // '\032'
                    switch(fr)
                    {
                    case 0: // '\0'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawRegion(game.axeIm, 0, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                        break;

                    case 1: // '\001'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawRegion(game.axeIm, 192, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                        break;

                    case 2: // '\002'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawRegion(game.axeIm, 256, 72, 64, 72, 2, (x - 32) + game.x1, y - 36, 0x10 | 4);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;

                case 27: // '\033'
                    switch(fr)
                    {
                    case 0: // '\0'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 0, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                        break;

                    case 1: // '\001'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 192, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                        break;

                    case 2: // '\002'
                        g.setClip((x - 32) + game.x1, y - 36, 64, 72);
                        g.clipRect((x - 32) + game.x1, y - 36, 64, 72);
                        g.drawImage(game.axeIm, (((x + game.x1) - 32) + game.axeIm.getWidth() / 2) - 256, ((y - 36) + game.axeIm.getHeight() / 2) - 72, 1 | 2);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;
                }
    }

    public void enemyDieSequence(Graphics g)
    {
        switch(face)
        {
        default:
            break;

        case 27: // '\033'
            switch(fr)
            {
            case 2: // '\002'
                y = 190;
                g.setClip((x - 28) + game.x1, y - 24, 56, 48);
                g.clipRect((x - 28) + game.x1, y - 24, 56, 48);
                g.drawImage(game.dieIm, (x + game.x1 + game.dieIm.getWidth() / 2) - 28, (y + game.dieIm.getHeight() / 2) - 24 - 48, 1 | 2);
                break;

            case 1: // '\001'
                g.setClip((x - 28) + game.x1, y - 24, 56, 48);
                g.clipRect((x - 28) + game.x1, y - 24, 56, 48);
                g.drawImage(game.dieIm, (x + game.x1 + game.dieIm.getWidth() / 2) - 28 - 56, (y + game.dieIm.getHeight() / 2) - 24 - 48, 1 | 2);
                fr++;
                break;

            case 0: // '\0'
                g.setClip((x - 28) + game.x1, y - 24, 56, 48);
                g.clipRect((x - 28) + game.x1, y - 24, 56, 48);
                g.drawImage(game.dieIm, (x + game.x1 + game.dieIm.getWidth() / 2) - 28 - 112, (y + game.dieIm.getHeight() / 2) - 24 - 48, 1 | 2);
                fr++;
                break;
            }
            g.setClip(0, 0, game.WIDTH, game.HEIGHT);
            break;

        case 26: // '\032'
            switch(fr)
            {
            case 0: // '\0'
                g.setClip((x - 28) + game.x1, y - 24, 56, 48);
                g.clipRect((x - 28) + game.x1, y - 24, 56, 48);
                g.drawRegion(game.dieIm, 112, 48, 56, 48, 2, (x - 28) + game.x1, y - 24, 0x10 | 4);
                fr++;
                break;

            case 1: // '\001'
                g.setClip((x - 28) + game.x1, y - 24, 56, 48);
                g.clipRect((x - 28) + game.x1, y - 24, 56, 48);
                g.drawRegion(game.dieIm, 56, 48, 56, 48, 2, (x - 28) + game.x1, y - 24, 0x10 | 4);
                fr++;
                break;

            case 2: // '\002'
                y = 190;
                g.setClip((x - 28) + game.x1, y - 24, 56, 48);
                g.clipRect((x - 28) + game.x1, y - 24, 56, 48);
                g.drawRegion(game.dieIm, 0, 48, 56, 48, 2, (x - 28) + game.x1, y - 24, 0x10 | 4);
                break;
            }
            g.setClip(0, 0, game.WIDTH, game.HEIGHT);
            break;
        }
    }

    public void enemyFall(Graphics g)
    {
        if(ehit && ebackAttack)
label0:
            switch(face)
            {
            default:
                break;

⌨️ 快捷键说明

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