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

📄 holymoley.java

📁 打地鼠,欢迎下载学习,游戏中,只做了一个关卡.
💻 JAVA
字号:
// 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

import java.util.Random;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

public class HolyMoley extends MIDlet
    implements CommandListener, Runnable
{

    private Display dp;
    private static Random rand = new Random();
    private Command ex;
    private Command start;
    private Command Pause;
    private Command Resume;
    private boolean play;
    private HC hc;
    private MsgBox mx;
    private Title ttl;
    private int sn;
    private int speed;

    public HolyMoley()
    {
        ex = new Command("Exit", 1, 3);
        start = new Command("Start", 1, 2);
        Pause = new Command("Pause", 1, 2);
        Resume = new Command("Resume", 1, 3);
        dp = Display.getDisplay(this);
        hc = new HC();
        mx = new MsgBox();
        ttl = new Title();
        hc.addCommand(Resume);
        hc.addCommand(Pause);
        hc.setCommandListener(this);
        mx.addCommand(ex);
        ttl.addCommand(ex);
        ttl.addCommand(start);
        ttl.setCommandListener(this);
        Title.mT = 2;
        Logo logo = new Logo(dp,ttl);
        dp.setCurrent(logo);
      //dp.setCurrent(ttl);
        ttl.repaint();
    }

    public void commandAction(Command command, Displayable displayable)
    {
        if(command == ex)
        {
            destroyApp(false);
            notifyDestroyed();
        } else
        if(command == start)
            firstStart();
        else
        if(command == Pause)
            pauseApp();
        else
        if(command == Resume)
        {
            startApp();
            restartThread();
        }
    }

    public void destroyApp(boolean flag)
    {
    }

    public void firstStart()
    {
        hc.init();
        sn = 0;
        speed = 60;
        HC.playSt = true;
        play = true;
        Thread thread = new Thread(this);
        thread.start();
    }

    public void pauseApp()
    {
        play = false;
    }

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

    public void run()
    {
        if(!play)
            return;
        do
        {
            threadP(speed);
            if(sn == 0)
                startSet();
            hc.repaint();
            if(HC.gameover)
            {
                threadP(800);
                Title.mT = 3;
                int i = hc.returnS();
                Title.mscore = i;
                dp.setCurrent(ttl);
                ttl.repaint();
                play = false;
                HC.playSt = false;
            } else
            if(!HC.playSt)
            {
                play = false;
                HC.playSt = false;
                threadP(800);
                MsgBox.mT = 1;
                MsgBox.life = hc.returnH();
                dp.setCurrent(mx);
                HC.score += 10 * hc.returnH();
                threadP(2000);
                if(sn == 6)
                {
                    Title.mT = 1;
                    int j = hc.returnS();
                    Title.mscore = j;
                    dp.setCurrent(ttl);
                    ttl.setCommandListener(this);
                    ttl.repaint();
                    play = false;
                    HC.playSt = false;
                } else
                {
                    startSet();
                }
            }
        } while(play);
    }

    public void startApp()
    {
        play = true;
    }

    public void startSet()
    {
        sn = sn + 1;
        HC.stnum = sn;
        speed = speed - 10;
        if(speed < 0)
            speed = 0;
        mx.setCommandListener(this);
        MsgBox.stgNum = sn;
        MsgBox.mT = 0;
        dp.setCurrent(mx);
        mx.repaint();
        threadP(1500);
        play = true;
        HC.playSt = true;
        dp.setCurrent(hc);
        hc.startSet();
        hc.repaint();
    }

    public void threadP(int i)
    {
        try
        {
            Thread.sleep(i);
        }
        catch(InterruptedException _ex) { }
    }
}

⌨️ 快捷键说明

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