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

📄 fighter.java

📁 j2me游戏都市骑士的代码,是一款横版格斗的游戏.可以学习参考.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 2005-11-26 11:40:50
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 

import java.io.PrintStream;
import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

class Fighter
    implements Constants
{

    public Fighter(short word0, short word1, Game game1)
    {
        action = 13;
        face = 26;
        isWeapon = false;
        Armor = new byte[1];
        ArmorCount = 0;
        ArmsCount = 0;
        hit = false;
        backAttack = false;
        fighterCtr = 0;
        hitCtr = 0;
        weaponPicked = false;
        maxY = 176;
        sumerSaltPerformed = false;
        f_lag = System.currentTimeMillis();
        jt = 0;
        axeJumpCtr = 0;
        chainJumpCtr = 0;
        x = word0;
        y = word1;
        health = 120;
        action = 13;
        game = game1;
        for(byte byte0 = 0; byte0 < 1; byte0++)
            Armor[byte0] = 127;

    }

    public void axeJump(Graphics g)
    {
        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, 0, 0, 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) - 0, (y - 36) + game.axeIm.getHeight() / 2, 1 | 2);
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

    public void axeWalk(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, 0, 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, 0, 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, 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, 1 | 2);
                break;
            }
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

    public void axeAttack(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, 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, 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, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 0, 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, 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, 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, 1 | 2);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;
                }
    }

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

        case 26: // '\032'
            switch(fr)
            {
            case 0: // '\0'
                if(System.currentTimeMillis() - f_lag >= 2000L && y < maxY - 15 - 2)
                    y -= 15;
                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, 1 | 2);
                break;

            case 1: // '\001'
                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) - 340, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                break;
            }
            break;

        case 27: // '\033'
            switch(fr)
            {
            default:
                break;

            case 0: // '\0'
                if(System.currentTimeMillis() - f_lag >= 2000L && y < maxY - 15 - 2)
                    y -= 15;
                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, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                break;

            case 1: // '\001'
                g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                g.drawRegion(game.chainIm, 340, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                break;
            }
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

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

        case 27: // '\033'
            switch(chainJumpCtr)
            {
            case 0: // '\0'
            case 1: // '\001'
                x += 3;
                g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                g.drawRegion(game.chainIm, 136, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                break;

            case 2: // '\002'
            case 3: // '\003'
            case 4: // '\004'
                x += 4;
                g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                g.drawRegion(game.chainIm, 136, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                break;

            case 5: // '\005'
            case 6: // '\006'
                x += 3;
                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, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                break;

            case 7: // '\007'
            case 8: // '\b'
            case 9: // '\t'
                x += 4;
                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, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                break;
            }
            break;

        case 26: // '\032'
            switch(chainJumpCtr)
            {
            case 0: // '\0'
            case 1: // '\001'
                x -= 3;
                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) - 204, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                break;

            case 2: // '\002'
            case 3: // '\003'
            case 4: // '\004'
                x -= 4;
                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) - 204, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                break;

            case 5: // '\005'
            case 6: // '\006'
                x -= 3;
                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) - 340, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                break;

            case 7: // '\007'
            case 8: // '\b'
            case 9: // '\t'
                x -= 4;
                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) - 340, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                break;
            }
            break;
        }
        g.setClip(0, 0, game.WIDTH, game.HEIGHT);
    }

    public void chainAttack(Graphics g)
    {
        if(weapon == 41)
            if(action == 15)
                switch(face)
                {
                case 26: // '\032'
                    switch(fr)
                    {
                    case 0: // '\0'
                        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, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                        break;

                    case 1: // '\001'
                        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) - 136, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                        break;

                    case 2: // '\002'
                        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) - 204, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                        break;

                    case 3: // '\003'
                        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, 1 | 2);
                        break;

                    case 4: // '\004'
                        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) - 340, (y - 32) + game.chainIm.getHeight() / 2, 1 | 2);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;

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

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

                    case 2: // '\002'
                        g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                        g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                        g.drawRegion(game.chainIm, 136, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                        break;

                    case 3: // '\003'
                        g.setClip((x - 34) + game.x1, y - 32, 68, 64);
                        g.clipRect((x - 34) + game.x1, y - 32, 68, 64);
                        g.drawRegion(game.chainIm, 204, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                        break;

                    case 4: // '\004'
                        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, 0, 68, 64, 2, (x - 34) + game.x1, y - 32, 0x10 | 4);
                        break;
                    }
                    g.setClip(0, 0, game.WIDTH, game.HEIGHT);
                    break;
                }
            else
            if(action == 17)
                switch(face)
                {
                default:
                    break;

⌨️ 快捷键说明

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