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

📄 battlechanger.java

📁 j2me 游戏 battle_changer(MOTO)工程。可以参考下。
💻 JAVA
📖 第 1 页 / 共 5 页
字号:

        }
        Object obj = null;
        cursor_x = width / 2 - 35;
        cursor_y = 80;
        game_state = 1;
        return;
    }

    public void show_logo()
    {
        System.gc();
        g.setColor(147, 213, 255);
        g.fillRect(0, 0, width, height);
        g.drawImage(parent.getImage("logo.png"), width / 2, height / 3, 0x2 | 0x1);
        g.drawImage(parent.getImage("cursor.png"), cursor_x, cursor_y + 30, 0x2 | 0x1);
        g.setColor(255, 0, 0);
        g.setColor(0, 0, 0);
        g.drawString("Start", width / 2 - 25, 105, 0x10 | 0x4);
        g.drawString("Score", width / 2 - 25, 120, 0x10 | 0x4);
        g.drawString("ReadMe", width / 2 - 25, 135, 0x10 | 0x4);
        g.drawString("Exit", width / 2 - 25, 150, 0x10 | 0x4);
        if(!ms_ready)
        {
            if(sound)
                parent.playWAV("0.wav");
            if(!vibration);
            ms_ready = true;
        }
        score = 0;
    }

    public void pause_menu()
    {
        g.setColor(0, 0, 255);
        g.fillRect(0, 0, width, height);
        g.setColor(255, 255, 0);
        g.drawRoundRect(width / 2 - 47, height / 2 - 55, 99, 60, 15, 10);
        g.setColor(255, 255, 0);
        g.drawString("Continue", width / 2 - 20, height / 2 - 50, 0x10 | 0x4);
        g.drawString("Menu", width / 2 - 20, height / 2 - 30, 0x10 | 0x4);
        g.drawString("Exit", width / 2 - 20, height / 2 - 10, 0x10 | 0x4);
        switch(menuSelected)
        {
        case 0: // '\0'
            g.drawImage(parent.getImage("cursor.png"), width / 2 - 25, height / 2 - 43, 0x2 | 0x1);
            break;

        case 1: // '\001'
            g.drawImage(parent.getImage("cursor.png"), width / 2 - 25, height / 2 - 28, 0x2 | 0x1);
            break;

        case 2: // '\002'
            g.drawImage(parent.getImage("cursor.png"), width / 2 - 25, height / 2 - 8, 0x2 | 0x1);
            break;
        }
        repaint(0, 0, width, height);
        serviceRepaints();
    }

    public void show_key()
    {
        g.setColor(0, 0, 0);
        g.fillRect(0, 0, width, height);
        g.setColor(0, 0, 255);
        g.drawRect(0, 0, width - 1, height - 1);
        g.drawRect(3, 3, width - 7, height - 7);
        g.drawImage(parent.getImage("cursor.png"), cursor_x + 50, cursor_y + width + 10, 0x2 | 0x1);
        g.setColor(200, 200, 100);
        if(menu == 1)
        {
            g.drawString("Set Key", width / 2 - 27, 10, 0x10 | 0x4);
            g.setColor(0, 255, 0);
            g.drawString("Move Up : Up,soft1", 5, 25, 0x10 | 0x4);
            g.drawString("Move Left : Down", 5, 40, 0x10 | 0x4);
            g.drawString("Move Right: Right", 5, 55, 0x10 | 0x4);
            g.drawString("Move Down: Left", 5, 70, 0x10 | 0x4);
            g.drawString("Shild On : Ok", 5, 85, 0x10 | 0x4);
            g.drawString("Chang: 4", 5, 100, 0x10 | 0x4);
        } else
        if(menu == 2)
        {
            g.drawString("OPTION", width / 2 - 27, 10, 0x10 | 0x4);
            g.setColor(0, 255, 0);
            g.drawString("Pause:soft2", 5, 25, 0x10 | 0x4);
            g.drawString("Sound ON-OFF: * ", 5, 40, 0x10 | 0x4);
            g.drawString("Vibration ON-OFF: # ", 5, 55, 0x10 | 0x4);
            g.drawString("Stop Move: 1 ", 5, 70, 0x10 | 0x4);
            g.drawString("Jump(TYPE2):Up", 5, 85, 0x10 | 0x4);
            g.setColor(250, 225, 0);
            g.drawString("GAME", width / 2 - 60, 100, 0x10 | 0x4);
            g.setColor(90, 210, 80);
            g.drawString("NEO.", width / 2 - 17, 100, 0x10 | 0x4);
            g.setColor(245, 160, 70);
            g.drawString("Co.Ltd", width / 2 + 13, 100, 0x10 | 0x4);
        }
        g.setColor(70, 70, 70);
        g.drawString("<-", 5, 10, 0x10 | 0x4);
        g.drawString("Prev", 17, 10, 0x10 | 0x4);
        g.drawString("Next", width - 53, 10, 0x10 | 0x4);
        g.drawString("->", width - 23, 10, 0x10 | 0x4);
        g.drawString("U/D", 5, 120, 0x10 | 0x4);
        g.drawString("Exit", 35, 120, 0x10 | 0x4);
        if(exit)
            g.setColor(255, 0, 0);
        g.drawString("EXIT", width - 40, 120, 0x10 | 0x4);
    }

    public void ending()
    {
        g.setColor(0, 0, 0);
        g.fillRect(0, 0, width, height);
        g.setColor(0, 0, 255);
        g.drawRect(0, 0, width - 1, height - 1);
        g.drawRect(3, 3, width - 7, height - 7);
        g.drawImage(parent.getImage("cursor.png"), cursor_x, cursor_y, 0x2 | 0x1);
        g.setColor(200, 200, 100);
        g.setColor(0, 255, 0);
        g.drawString("The human put down the", 5, 10, 0x10 | 0x4);
        g.drawString("evolt of machine.", 5, 25, 0x10 | 0x4);
        g.drawString("Although human have", 5, 40, 0x10 | 0x4);
        g.drawString("at a considerable", 5, 55, 0x10 | 0x4);
        g.drawString("sacrifice,the result", 5, 70, 0x10 | 0x4);
        g.drawString("human know human's", 5, 85, 0x10 | 0x4);
        g.drawString("life.", 5, 100, 0x10 | 0x4);
        g.setColor(70, 70, 70);
        g.drawString("U/D", 5, 120, 0x10 | 0x4);
        g.drawString("Exit", 30, 120, 0x10 | 0x4);
        if(exit)
            g.setColor(255, 0, 0);
        g.drawString("END", width - 30, 120, 0x10 | 0x4);
    }

    public void hideNotify()
    {
        if(!pause)
        {
            pause = true;
            menu = 1;
            return;
        } else
        {
            return;
        }
    }

    public void stage()
    {
        red = 0;
        green = 0;
        blue = 0;
        red2 = 120;
        green2 = 120;
        blue2 = 230;
        count = 0;
        shield_timer = 0;
        power_x = -50;
        power_y = -50;
        bullet_count = 0;
        m_st = 0;
        laser_count = 0;
        block_x = width + 10;
        block_y = height / 5 + 7;
        cursor_x = 30;
        cursor_y = 45;
        player_x = 18;
        player_y = height / 2;
        stage_clear = false;
        delay_timing = false;
        grum_x[0] = random_state(width + 10 + width / 2);
        grum_y[0] = random_state(height / 5);
        grum_x[1] = random_state(width + 20 + width / 2);
        grum_y[1] = random_state(height / 5);
        grum_x[2] = random_state(width + 30 + width / 2);
        grum_y[2] = random_state(height / 5);
        grum_x[3] = random_state(width + 40 + width / 2);
        grum_y[3] = random_state(height / 5);
        if(life_count == 0)
            life_count = 3;
        for(int i = 0; i < 2; i++)
        {
            bullet_x[i] = -500;
            bullet_y[i] = -500;
            bullet2_x[i] = -500;
            bullet2_y[i] = -500;
            bullet3_x[i] = -500;
            bullet3_y[i] = -500;
            eb_p[i] = 0;
        }

        mb_c = 0;
        for(int j = 0; j < 8; j++)
        {
            boom_x[j]= -50;
            boom_y[j] = -50;
        }

        if(game_stage == 1)
        {
            for(int k = 0; k < 4; k++)
            {
                t_x[k] = width + 20 + random_state(200);
                t_y[k] = height / 3 + random_state(height / 2);
                g_c[k] = 0;
                h_count[k] = 0;
                s_b_count[k] = 0;
                h_e_x[k] = -50;
                h_e_y[k] = -50;
                tp_x[k] = width + 30;
                tp_y[k] = -50;
                tp_p[k] = 0;
                btp_p[k] = 0;
                btp_c[k] = 0;
                btp_x[k] = -50;
                btp_y[k] = -50;
                s_c[k] = 0;
            }

            for(int k1 = 0; k1 < 12; k1++)
            {
                e_x[k1] = -50;
                e_y[k1] = -50;
            }

            bg_x[0] = random_state(width);
            bg_y[0] = height - 20;
            bg_x[1] = random_state(width);
            bg_y[1] = height - 20;
            bg_x[2] = random_state(width);
            bg_y[2] = height - 20;
            type = 2;
            speed = 4;
            btp_c2 = 0;
            ground_x = width + 10;
            ground_y = height / 3;
            boss_hp = 100;
            m_boss_x = width + 30;
            m_boss_y = height / 3 - 7;
            laser2_x = -50;
            laser2_y = -50;
            b_x[0] = width + 20 + random_state(width / 2);
            b_y[0] = height / 2 + random_state(height / 2);
            b_x[1] = width + 40 + random_state(width / 2);
            b_y[1] = height / 2 + random_state(height / 2);
            b_x[2] = width + 60 + random_state(width / 2);
            b_y[2] = height / 2 + random_state(height / 2);
            b_x[3] = width + 80 + random_state(width / 2);
            b_y[3] = height / 2 + random_state(height / 2);
            h_x[0] = random_state(width);
            h_y[0] = -20;
            h_x[1] = random_state(width);
            h_y[1] = -40;
            h_x[2] = random_state(width);
            h_y[2] = -60;
            h_x[3] = random_state(width);
            h_y[3] = -80;
            p_x[0] = width + 20;
            p_y[0] = height / 3 + random_state(height / 3);
            p_x[1] = width + 60;
            p_y[1] = height / 3 + random_state(height / 3);
            p_x[2] = width + 100;
            p_y[2] = height / 3 + random_state(height / 3);
            p_x[3] = width + 140;
            p_y[3] = height / 3 + random_state(height / 3);
        } else
        if(game_stage == 2)
        {
            bg_x[0] = width + 23 + random_state(width);
            bg_y[0] = height - 45;
            bg_x[1] = width + 22 + random_state(width);
            bg_y[1] = height - 48;
            bg_x[2] = width + 11 + random_state(width);
            bg_y[2] = height - 46;
            missile_x = -50;
            missile_y = -60;
            type = 1;
            speed = 5;
            laser_x = width + 10;
            ground_x = 0;
            ground_y = height - 40;
            jump_e_state = 0;
            jump_eb_state = 0;
            wpo_p = 0;
            repeat_count = 0;
            jump_count = 0;
            mine_count = 0;
            bound_count = 0;
            m_count = 0;
            m_p = 0;
            boss_hp = 150;
            m_boss_x = width + 30;
            m_boss_y = height - 50;
            player_shot = 2;
            player_shot_state = 0;
            jump_e_x = width + 30;
            jump_e_y = height - 40;
            jump_eb_x = -50;
            jump_eb_y = -50;
            mine_x = width + 20;
            mine_y = height - 30;
            h_x[0] = random_state(width);
            h_y[0] = -20;
            h_x[1] = random_state(width);
            h_y[1] = -40;
            h_x[2] = random_state(width);
            h_y[2] = -60;
            h_x[3] = random_state(width);
            h_y[3] = -80;
            b_x[0] = width + 20;
            b_y[0] = 20;
            b_x[1] = width + 40;
            b_y[1] = 20;
            b_x[2] = width + 60;
            b_y[2] = 20;
            b_x[3] = width + 80;
            b_y[3] = 20;
            wpo_x = random_state(width);
            wpo_y = -50;
            for(int l = 0; l < 4; l++)
            {
                h_e_x[l] = -50;
                h_e_y[l] = -50;
                h_count[l] = 0;
                b_p[l] = 0;
            }

            for(int l1 = 0; l1 < 5; l1++)
            {
                e_x[l1] = -50;
                e_y[l1] = -50;
            }

        }
        if(game_stage == 3)
        {
            type = 0;
            speed = 6;
            laser_x = -50;
            laser_y = -50;
            laser2_x = -50;
            laser2_y = -50;
            t_c = 0;
            boss_hp = 200;
            m_boss_x = width / 4;
            m_boss_y = height;
            wg_ebullet = 0;
            p_c = 0;
            se_c = 0;
            t_c = 0;
            be_c = 0;
            t_x[0] = width + 30;
            t_y[0] = 5;
            t_x[1] = width + 50;
            t_y[1] = 5;
            t_x[2] = width + 70;
            t_y[2] = 5;
            t_x[3] = width + 30;
            t_y[3] = height - 40;
            t_x[4] = width + 50;

⌨️ 快捷键说明

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