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

📄 gamescreen.java~6~

📁 Source code of J2ME game called Action Soccer. Great for used. Already configurations with JBuilder
💻 JAVA~6~
📖 第 1 页 / 共 5 页
字号:
                        if(messageTime > 0)
                            messageTime -= 200;
                        lastReleased += 15;
                        GameScreen _tmp2 = this;
                        Thread.sleep(150L);
                    }
                    if(nextMessageType != -1 && messageTime <= 0)
                    {
                        messageType = nextMessageType;
                        messageTime = 3000;
                        nextMessageType = -1;
                    }
                }
            }
            catch(Exception exception)
            {
                System.out.println(exception);
            }
    }

    protected void keyReleased(int i)
    {
        int j = getGameAction(i);
        switch(j)
        {
        case 1: // '\001'
            keyUp = keyRight = keyLeft = keyDown = false;
            lastReleased = 0;
            break;

        case 6: // '\006'
            keyUp = keyRight = keyLeft = keyDown = false;
            lastReleased = 0;
            break;

        case 5: // '\005'
            keyUp = keyRight = keyLeft = keyDown = false;
            lastReleased = 0;
            break;

        case 2: // '\002'
            keyUp = keyRight = keyLeft = keyDown = false;
            lastReleased = 0;
            break;

        case 3: // '\003'
        case 4: // '\004'
        default:
            switch(i)
            {
            case 49: // '1'
                keyUp = false;
                keyLeft = false;
                break;

            case 51: // '3'
                keyUp = false;
                keyRight = false;
                break;

            case 57: // '9'
                keyDown = false;
                keyRight = false;
                break;

            case 55: // '7'
                keyDown = false;
                keyLeft = false;
                break;
            }
            break;
        }
        setDirection();
    }

    public static void softKey1Pressed()
    {
        if(mode == 7)
        {
            mode = 0;
            GameMidlet.m_display.setCurrent(GameMidlet.menuScreen);
        } else
        if(mode != 0)
        {
            if(mode != 2)
                previousMode = mode;
            mode = 7;
        }
    }

    public static void softKey2Pressed()
    {
        if(mode == 7 || mode == 2)
            mode = previousMode;
        else
        if(mode != 0)
        {
            previousMode = mode;
            mode = 2;
        }
    }

    protected void keyPressed(int i)
    {
        int j = getGameAction(i);
        if(i == -6)
            softKey1Pressed();
        else
        if(i == -7)
            softKey2Pressed();
        switch(j)
        {
        case 1: // '\001'
            keyUp = true;
            if(lastDirection == 2 && lastReleased < 31)
                keyRight = true;
            if(lastDirection == 6 && lastReleased < 31)
                keyLeft = true;
            break;

        case 6: // '\006'
            keyDown = true;
            if(lastDirection == 2 && lastReleased < 31)
                keyRight = true;
            if(lastDirection == 6 && lastReleased < 31)
                keyLeft = true;
            break;

        case 5: // '\005'
            keyRight = true;
            if(lastDirection == 0 && lastReleased < 31)
                keyUp = true;
            if(lastDirection == 4 && lastReleased < 31)
                keyDown = true;
            break;

        case 2: // '\002'
            keyLeft = true;
            if(lastDirection == 0 && lastReleased < 31)
                keyUp = true;
            if(lastDirection == 4 && lastReleased < 31)
                keyDown = true;
            break;

        case 8: // '\b'
            keyKick = true;
            break;

        case 3: // '\003'
        case 4: // '\004'
        case 7: // '\007'
        default:
            switch(i)
            {
            case 49: // '1'
                keyUp = true;
                keyLeft = true;
                break;

            case 51: // '3'
                keyUp = true;
                keyRight = true;
                break;

            case 57: // '9'
                keyDown = true;
                keyRight = true;
                break;

            case 55: // '7'
                keyDown = true;
                keyLeft = true;
                break;
            }
            break;
        }
        setDirection();
        if(direction != -1)
            lastDirection = direction;
    }

    public void setDirection()
    {
        if(keyUp)
        {
            if(keyLeft)
                direction = 7;
            else
            if(keyRight)
                direction = 1;
            else
                direction = 0;
        } else
        if(keyDown)
        {
            if(keyLeft)
                direction = 5;
            else
            if(keyRight)
                direction = 3;
            else
                direction = 4;
        } else
        if(keyLeft)
            direction = 6;
        else
        if(keyRight)
            direction = 2;
        else
            direction = -1;
    }

    public void setCenterPoint(int i, int j)
    {
        if(i < screenWidth / 2)
            fieldX = 0;
        else
        if(i > 350 - screenWidth / 2)
            fieldX = 350 - screenWidth;
        else
            fieldX = i - screenWidth / 2;
        if(j < screenHeight / 2)
            fieldY = 0;
        else
        if(j > 550 - screenHeight / 2)
            fieldY = 550 - screenHeight;
        else
            fieldY = j - screenHeight / 2;
    }

    int extraTime;
    public static Image herb;
    public static Image top;
    public static Image bottom;
    public static Image confirm;
    public static Image mground;
    public static Image gate1;
    public static Image gate2;
    public static Image ballImage;
    private Image b;
    private Graphics bg;
    protected static Image players;
    protected static Image shadow;
    private final int nMessages = 19;
    private String messages[];
    public static final int nPlayers = 7;
    public static final int nearBallPositions[][] = {
        {
            -70, -70
        }, {
            -70, 70
        }, {
            70, -70
        }, {
            70, 70
        }, {
            0, -150
        }, {
            0, 150
        }, {
            -150, 0
        }, {
            150, 0
        }, {
            -70, -200
        }, {
            -70, 200
        }, {
            70, -200
        }, {
            70, 200
        }
    };
    private static final int messageDuration = 3000;
    public int startPositions[][][];
    public static final int fieldWidth = 350;
    public static final int fieldHeight = 550;
    public static final int LEFT_LINE = 10;
    public static final int RIGHT_LINE = 340;
    public static final int LEFT_GOAL_LINE = 140;
    public static final int RIGHT_GOAL_LINE = 210;
    public static final int UP_LINE = 30;
    public static final int DOWN_LINE = 520;
    public static final int GKAREA_LEFT = 74;
    public static final int GKAREA_RIGHT = 276;
    public static final int GKAREA_UP = 90;
    public static final int GKAREA_DOWN = 460;
    protected static final int KICK_DIST = 75;
    protected static final int MODE_NONE = 0;
    protected static final int MODE_GAME = 1;
    protected static final int MODE_PAUSE = 2;
    protected static final int MODE_STARTWAIT = 3;
    protected static final int MODE_MOVEWAIT = 4;
    protected static final int MODE_GOAL = 5;
    protected static final int MODE_TIME_FINISHED = 6;
    protected static final int MODE_CONFIRM_EXIT = 7;
    protected static final int MODE_BALLOUTSIDE = 8;
    protected static final int MODE_KICKAWAITING = 9;
    protected static final int MODE_VS = 10;
    protected static final int MODE_GOALLINE = 11;
    protected static final int MODE_GOALLINEKICKAWAITING = 12;
    protected static final int MODE_HALFTIME = 13;
    protected static final int MODE_FAULT = 14;
    protected static final int MODE_PENALTYKICK = 15;
    protected static final int MODE_FREEKICK = 16;
    protected static int compCommand = 0;
    protected static int userCommand = 0;
    protected static int compCommandColor = 0;
    protected static int userCommandColor = 0;
    public static int fieldX = 0;
    public static int fieldY 

⌨️ 快捷键说明

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