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

📄 battlechanger.java

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

            if(type == 1)
            {
                g.drawImage(parent.getImage(player_shot + ".png"), player_x, player_y, 0x2 | 0x1);
            } else
            if(type == 2)
            {
                g.drawImage(parent.getImage("3.png"), player_x, player_y, 0x2 | 0x1);
            } else
            {
                g.drawImage(parent.getImage("0.png"), player_x, player_y, 0x2 | 0x1);
            }
            if(boom_x[boom] > -20 && boom_x[boom] < width + 10 && boom_y[boom] > -20 && boom_y[boom] < height + 10)
            {
                g.drawImage(parent.getImage("13.png"), boom_x[boom], boom_y[boom], 0x2 | 0x1);
                boom_x[boom] = -50;
                boom_y[boom] = -50;
            }
            if(shield_check)
            {
                g.setColor(255, 255, 255);
                g.drawArc(player_x - 20, player_y - 10, 35, 20, 10, 360);
            }
            if(power_x > -20 && power_x < width + 10 && power_y > -20 && power_y < height + 10)
            {
                g.drawImage(parent.getImage("power.png"), power_x, power_y, 0x2 | 0x1);
            }
            if(game_stage == 1 || game_stage == 4)
            {
                g.setColor(5, 25, 150);
                if(game_stage == 1)
                    g.drawLine(0, height / 3, ground_x - 2, height / 3);
                else
                if(game_stage == 4)
                {
                    for(int j2 = 3; j2 < 11; j2++)
                        if(g_con == 0)
                            g.drawLine(0, height / 4, bg_x[3] - 11, height / 4);

                }
            }
            g.setColor(5, 25, 150);
            g.fillRect(0, height - 15, width, height);
            g.fillRect(1, height - 16, width - 2, 14);
            g.fillRect(1, height - 16, width - 2, 15);
            g.setColor(200, 155, 55);
            g.drawString("Score:" + Integer.toString(score), width / 2 - 6, height - 15, 0x10 | 0x4);
            for(int k2 = 0; k2 < life_count - 1; k2++)
                if(type == 1)
                {
                    g.drawImage(parent.getImage("p1.png"), life_x[k2], height - 8, 0x2 | 0x1);
                } else
                if(type == 2)
                {
                    g.drawImage(parent.getImage("p2.png"), life_x[k2], height - 8, 0x2 | 0x1);
                } else
                {
                    g.drawImage(parent.getImage("p0.png"), life_x[k2], height - 8, 0x2 | 0x1);
                }

            if(pause)
                if(menu == 1)
                    game_state = 1;
                else
                if(menu == 2)
                {
                    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.setColor(255, 0, 255);
                    g.drawString("Pause!!", width / 2 - 15, 5, 0x10 | 0x4);
                    if(sound)
                    {
                        g.drawString("Sound:ON", 5, 109, 0x10 | 0x4);
                    } else
                    {
                        g.drawString("Sound:OFF", 5, 109, 0x10 | 0x4);
                    }
                    if(vibration)
                    {
                        g.drawString("Sound:ON", width / 2, 109, 0x10 | 0x4);
                    } else
                    {
                        g.drawString("Sound:OFF", width / 2, 109, 0x10 | 0x4);
                    }
                    g.drawString("Fire:Ez-i", 5, 18, 0x10 | 0x4);
                    g.drawString("Chage:Num 4", 5, 31, 0x10 | 0x4);
                    g.drawString("Pause:soft2", 5, 44, 0x10 | 0x4);
                    g.drawString("Sound: * ", 5, 57, 0x10 | 0x4);
                    g.drawString("Vibrate: # ", 5, 70, 0x10 | 0x4);
                    g.drawString("MoveStop:Num1", 5, 83, 0x10 | 0x4);
                    g.drawString("Jump(TYPE2):UP", 5, 96, 0x10 | 0x4);
               }
            if(pause && cursor_s)
                game_config();
            if(!stage_clear)
            if(game_stage != 4)
            {
                stage_clear = false;
                g.setColor(255, 255, 255);
                g.drawString("! Stage Clear !", width / 2 - 47, height / 2 - 15, 0x10 | 0x4);
                g.setColor(0, 0, 0);
                delay_timing = true;
                game_stage++;
                game_state = 2;
            }
            stage_clear = false;
            g.setColor(255, 255, 255);
            g.drawString("! Congratulations !", width / 2 - 42, height / 2 - 40, 0x10 | 0x4);
            g.drawString("!ALL STAGE CLEAR!", width / 2 - 54, height / 2 - 20, 0x10 | 0x4);
            if(score > hiscore)
            {
                g.drawString("NEWHISCORE:" + Integer.toString(score), width / 2 - 45, height / 2, 0x10 | 0x4);
            }
            g.setColor(120, 120, 230);
            g.fillRect(0, 0, width, height);
            RecordStore recordstore = null;
            if(score <= hiscore)
            hiscore = score;
            byte abyte0[] = new byte[2];
            if(score > 255)
            {
                int i6;
                for(i6 = 0; score > 255; i6++)
                    score -= 255;

                abyte0[0] = (byte)i6;
                abyte0[1] = (byte)(score & 0xff);
            } else
            {
                abyte0[0] = 0;
                abyte0[1] = (byte)(score & 0xff);
            }
            try
            {
                recordstore = RecordStore.openRecordStore("battlechanger", false);
                recordstore.setRecord(1, abyte0, 0, 2);
            }
            catch(Exception exception)
            {
                try
                {
                    recordstore.closeRecordStore();
                    Object obj1 = null;
                    recordstore = null;
                }
                catch(Exception exception4) { }
            }
            finally
            {
                try
                {
                    recordstore.closeRecordStore();
                    Object obj2 = null;
                    recordstore = null;
                }
                catch(Exception exception5) { }
            }
            try
            {
                recordstore.closeRecordStore();
                Object obj = null;
                recordstore = null;
            }
            catch(Exception exception3) { }
        }
//        delay_timing = true;
//        game_stage = 1;
//        power_up = 0;
//        cursor_x = -30;
//        cursor_y = 127;
//        game_state = 6;
//        System.gc();

        {
            if(!game_over)
            g.setColor(255, 255, 255);
            if(life_count != 1)
            g.drawString("! GAME OVER !", width / 2 - 43, height / 2 - 15, 0x10 | 0x4);
            RecordStore recordstore1 = null;
            if(score <= hiscore)
            hiscore = score;
            byte abyte1[] = new byte[2];
            if(score > 255)
            {
                int j6;
                for(j6 = 0; score > 255; j6++)
                    score -= 255;

                abyte1[0] = (byte)j6;
                abyte1[1] = (byte)(score & 0xff);
            } else
            {
                abyte1[0] = 0;
                abyte1[1] = (byte)(score & 0xff);
            }
            try
            {
                recordstore1 = RecordStore.openRecordStore("battlechanger", false);
                recordstore1.setRecord(1, abyte1, 0, 2);
            }
            catch(Exception exception1)
            {
                try
                {
                    recordstore1.closeRecordStore();
                    Object obj4 = null;
                    recordstore1 = null;
                }
                catch(Exception exception8) { }

            }
            finally
            {
                try
                {
                    recordstore1.closeRecordStore();
                    Object obj5 = null;
                    recordstore1 = null;
                }
                catch(Exception exception9) { }
            }
            try
            {
                recordstore1.closeRecordStore();
                Object obj3 = null;
                recordstore1 = null;
            }
            catch(Exception exception7) { }

        delay_timing = true;
        game_over = false;
        game_stage = 1;
        cursor_x = width / 2 - 35;
        cursor_y = 80;
        score = 0;
        game_state = 0;
        power_up = 0;
        if(!vibration);
        life_count--;
        game_over = false;
    }

    public void plane(int i)
    {
        if(fire[i])
            bullet_x[i] += 15;
        if(fire2[i])
            if(type == 0)
            {
                if(power_up == 3)
                {
                    bullet2_x[i] += 15;
                    bullet2_y[i] -= 5;
                }
            } else
            if(type == 1)
            {
                if(power_up >= 1)
                    bullet2_y[i] -= 5;
            } else
            if(power_up >= 1)
                bullet2_y[i] -= 5;
        if(fire3[i])
            if(type == 0)
            {
                if(power_up == 3)
                {
                    bullet3_x[i] += 15;
                    bullet3_y[i] += 5;
                }
            } else
            if(type == 2 && power_up == 3)
                bullet3_y[i] += 3;
        if(game_stage == 4)
        {
            for(int j = 3; j < 11; j++)
                if(bullet_x[i] + 5 > bg_x[j] - 10 && bullet_y[i] - 2 < bg_y[j] + 15 && bullet_x[i] - 5 < bg_x[j] + 10)
                {
                    fire[i] = false;
                    bullet_x[i] = -500;
                    bullet_y[i] = -500;
                }

        }
        if(bullet_x[i] >= width + 10)
        {
            fire[i] = false;
            bullet_x[i] = -500;
            bullet_y[i] = -500;
        }
        if(type == 0)
        {
            if(bullet2_x[i] >= width + 10)
            {
                fire2[i] = false;
                bullet2_x[i] = -500;
                bullet2_y[i] = -500;
            }
            if(bullet3_x[i] >= width + 10)
            {
                fire3[i] = false;
                bullet3_x[i] = -500;
                bullet3_y[i] = -500;
            }
        } else
        {
            if(game_stage == 4)
            {
                for(int k = 3; k < 11; k++)
                    if(player_x > bg_x[k] - 20 && player_x < bg_x[k] + 20 && bullet2_y[i] - 3 < bg_y[k] + 15)
                    {
                        fire2[i] = false;
                        bullet2_x[i] = -500;
                        bullet2_y[i] = -500;
                    }

            }
            if(bullet2_y[i] < 0)
            {
                fire2[i] = false;
                bullet2_x[i] = -500;
                bullet2_y[i] = -500;
            }
        }
        if(type == 2)
            if(game_stage != 4)
            {
                if(bullet3_y[i] >= height)
                {
                    fire3[i] = false;
                    bullet3_x[i] = -500;
                    bullet3_y[i] = -500;
                }
            } else
            if(bullet3_y[i] >= height - 22)
            {
                fire3[i] = false;
                bullet3_x[i] = -500;
                bullet3_y[i] = -500;
            }
    }

    public void grum_state(int i)
    {
        g.setColor(255, 255, 255);
        g.fillRoundRect(grum_x[i], grum_y[i], 25, 10, 10, 10);
        g.fillRoundRect(grum_x[i] + 10, grum_y[i] - 5, 10, 18, 10, 10);
        g.fillRoundRect(grum_x[i] + 3, grum_y[i] - 3, 10, 15, 10, 10);
        if(game_stage == 4)
        {
            if(block_x > width + 5 && grum_x[i] < -50)
            {
                int j = 20;
                grum_x[i] = width + j + random_state(width / 2);
                g

⌨️ 快捷键说明

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