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

📄 battlechanger.java

📁 j2me 游戏 battle_changer(MOTO)工程。可以参考下。
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name:   BattleChanger.java

import com.nokia.mid.ui.FullCanvas;
import java.util.Random;
import javax.microedition.lcdui.*;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreNotFoundException;

class BattleChanger extends FullCanvas
    implements Runnable
{

    private BattleChangerMIDlet parent;
    private Thread thread;
    private boolean isPaused;
    private int menuSelected;
    private Graphics offScrGC;
    Image offScrImage;
    Graphics g;
    Random random;
    int g_con;
    int bg_x[];
    int bg_y[];
    int score;
    int hiscore;
    int volume_level;
    int ground_x;
    int ground_y;
    int shield_timer;
    int red;
    int green;
    int blue;
    int red2;
    int green2;
    int blue2;
    int cursor_x;
    int cursor_y;
    int player_x;
    int player_y;
    final int life_x[] = {
        10, 35
    };
    int power_x;
    int power_y;
    final int width = getWidth();
    final int height = getHeight();
    int boom_x[];
    int boom_y[];
    int bullet_x[];
    int bullet_y[];
    int bullet2_x[];
    int bullet2_y[];
    int bullet3_x[];
    int bullet3_y[];
    int grum_x[];
    int grum_y[];
    int power_up;
    short menu;
    short motion;
    short life_count;
    short player_shot;
    short player_shot_state;
    short game_stage;
    short type;
    short speed;
    short count;
    short game_state;
    short jump_e_state;
    short jump_eb_state;
    short m_st;
    short p_p[];
    short tp_p[];
    short b_p[];
    short m_p;
    short btp_p[];
    short eb_p[];
    short wpo_p;
    short wg_ebullet;
    short tptp_po[];
    short boss_hp;
    short b_hp;
    short boom;
    short bullet_count;
    int t_x[];
    int t_y[];
    int p_x[];
    int p_y[];
    int s_x[];
    int s_y[];
    int f_x[];
    int f_y[];
    int b_x[];
    int b_y[];
    int power_persent;
    int wpo_x;
    int wpo_y;
    int h_x[];
    int h_y[];
    int block_x;
    int block_y;
    int mine_x;
    int mine_y;
    int jump_e_x;
    int jump_e_y;
    int m_boss_x;
    int m_boss_y;
    int boss_x;
    int boss_y;
    int t_e_x[];
    int t_e_y[];
    int h_e_x[];
    int h_e_y[];
    int mb_e_x[];
    int mb_e_y[];
    int jump_eb_x;
    int jump_eb_y;
    int e_x[];
    int e_y[];
    int wg_e_x[];
    int wg_e_y[];
    int eb_x[];
    int eb_y[];
    int tp_x[];
    int tp_y[];
    int tp_tp_x[];
    int tp_tp_y[];
    int btp_x[];
    int btp_y[];
    int laser_x;
    int laser_y;
    int laser2_x;
    int laser2_y;
    int missile_x;
    int missile_y;
    short f_c[];
    short g_c[];
    short p_c;
    short mb_c;
    short s_c[];
    short h_count[];
    short s_b_count[];
    short se_c;
    short t_c;
    short be_c;
    short btp_c[];
    short btp_c2;
    short laser_count;
    short repeat_count;
    short jump_count;
    short mine_count;
    short bound_count;
    short wg_count;
    short wpo_count;
    short back_count[];
    short tptp_count[];
    short m_count;
    short spark_count;
    boolean jump;
    boolean shield_check;
    boolean player_start;
    boolean stage_clear;
    boolean game_over;
    boolean delay_timing;
    boolean turn_enemy[];
    boolean turn_ebullet[];
    boolean slant_enemy[];
    boolean shoot_boom[];
    boolean ebullet[];
    boolean m_boss_ebullet[];
    boolean fire[];
    boolean fire2[];
    boolean fire3[];
    boolean vibration;
    boolean sound;
    boolean left_move;
    boolean power;
    private boolean pause;
    boolean exit;
    boolean ms_ready;
    boolean cursor_s;
    boolean opening;

    synchronized void start()
    {
        thread = new Thread(this);
        thread.start();
    }

    synchronized void stop()
    {
        thread = null;
    }

    public BattleChanger(BattleChangerMIDlet battlechangermidlet)
    {
        isPaused = false;
        menuSelected = 0;
        volume_level = 2;
        power_up = 0;
        sound = false;
        pause = false;
        opening = true;
        parent = battlechangermidlet;
        offScrImage = Image.createImage(width, height);
        g = offScrImage.getGraphics();
        random = new Random();
        bg_x = new int[11];
        bg_y = new int[11];
        grum_x = new int[4];
        grum_y = new int[4];
        boom_x = new int[8];
        boom_y = new int[8];
        bullet_x = new int[2];
        bullet_y = new int[2];
        bullet2_x = new int[2];
        bullet2_y = new int[2];
        bullet3_x = new int[2];
        bullet3_y = new int[2];
        fire = new boolean[2];
        fire2 = new boolean[2];
        fire3 = new boolean[2];
        h_x = new int[4];
        h_y = new int[4];
        b_x = new int[4];
        b_y = new int[4];
        t_x = new int[6];
        t_y = new int[6];
        p_x = new int[8];
        p_y = new int[8];
        s_x = new int[8];
        s_y = new int[8];
        f_x = new int[10];
        f_y = new int[10];
        eb_x = new int[4];
        eb_y = new int[4];
        tp_x = new int[4];
        tp_y = new int[4];
        btp_x = new int[4];
        btp_y = new int[4];
        h_e_x = new int[4];
        h_e_y = new int[4];
        t_e_x = new int[6];
        t_e_y = new int[6];
        mb_e_x = new int[6];
        mb_e_y = new int[6];
        wg_e_x = new int[2];
        wg_e_y = new int[2];
        e_x = new int[12];
        e_y = new int[12];
        tp_tp_x = new int[2];
        tp_tp_y = new int[2];
        g_c = new short[4];
        f_c = new short[10];
        s_c = new short[4];
        h_count = new short[4];
        btp_c = new short[4];
        s_b_count = new short[12];
        back_count = new short[2];
        tptp_count = new short[2];
        p_p = new short[8];
        tp_p = new short[4];
        btp_p = new short[4];
        eb_p = new short[2];
        b_p = new short[4];
        tptp_po = new short[2];
        turn_enemy = new boolean[6];
        ebullet = new boolean[12];
        shoot_boom = new boolean[4];
        slant_enemy = new boolean[8];
        turn_ebullet = new boolean[6];
        m_boss_ebullet = new boolean[6];
        game_stage = 1;
    }

    public void game_config()
    {
        g.setColor(0, 0, 0);
        g.fillRect(0, 0, width, height);
        g.drawImage(parent.getImage("cursor.png"), cursor_x, cursor_y, 0x2 | 0x1);
        g.setColor(0, 0, 255);
        g.drawString("Set Sound", width / 2 - 35, 20, 0x10 | 0x4);
        if(sound)
        {
            g.setColor(150, 150, 150);
            g.drawString("Hi", width / 2 - 40, 40, 0x10 | 0x4);
            g.drawString("No", width / 2 - 20, 40, 0x10 | 0x4);
            g.drawString("Lo", width / 2 - 0, 40, 0x10 | 0x4);
            g.drawString("OFF", width / 2 + 20, 40, 0x10 | 0x4);
            if(volume_level == 1)
            {
                g.setColor(0, 255, 0);
                g.drawString("Hi", width / 2 - 40, 40, 0x10 | 0x4);
            } else
            if(volume_level == 2)
            {
                g.setColor(0, 255, 0);
                g.drawString("No", width / 2 - 20, 40, 0x10 | 0x4);
            } else
            if(volume_level == 3)
            {
                g.setColor(0, 255, 0);
                g.drawString("Lo", width / 2 - 0, 40, 0x10 | 0x4);
                g.setColor(150, 150, 150);
            }
        }
        if(!sound)
        {
            g.setColor(150, 150, 150);
            g.drawString("ON", width / 2 - 30, 40, 0x10 | 0x4);
            g.setColor(255, 0, 0);
            g.drawString("OFF", width / 2 + 10, 40, 0x10 | 0x4);
        }
        g.setColor(255, 255, 100);
        g.drawString("EXIT", width / 2 - 35, 120, 0x10 | 0x4);
    }

    public void game_score()    {
        g.setColor(0, 0, 0);
        g.fillRect(0, 0, width, height);
        g.setColor(200, 155, 55);
        g.drawString("HISCORE:" + Integer.toString(hiscore), width / 2 - 40, height / 2, 0x10 | 0x4);
        repaint(0, 0, width, height);
        delay(3000);
        cursor_x = width / 2 - 35;
        cursor_y = 78;
        game_state = 1;
    }

    public void load_image()
    {

        try
        {
          RecordStore recordstore = null;
          byte abyte0[] = new byte[2];
          recordstore = RecordStore.openRecordStore("battlechanger", false);
          abyte0 = recordstore.getRecord(1);
          hiscore = (abyte0[0] & 0xff) * 255 + (abyte0[1] & 0xff);
          abyte0 = null;
          recordstore.closeRecordStore();
        }
        catch(Exception exception3) {
      }
        try
        {
            RecordStore recordstore = null;
            recordstore = RecordStore.openRecordStore("battlechanger", true);
            byte abyte1[] = new byte[2];
            abyte1[0] = 0;
            abyte1[1] = 0;
            recordstore.addRecord(abyte1, 0, 2);
            abyte1 = null;
             recordstore.closeRecordStore();
        }
        catch(Exception exception) {

⌨️ 快捷键说明

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