博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java版推箱子(搬箱子)游戏开发入门示例及源码
阅读量:2200 次
发布时间:2019-05-03

本文共 13054 字,大约阅读时间需要 43 分钟。

分享一下我老师大神的人工智能教程!零基础,通俗易懂!

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

 

推(搬)箱子,又名Sokoban,仓库番等,是一款堪称古玩级的电脑游戏。

提起它,笔者相信没什么人会感觉到陌生,更没什么生物会连听都没听说过。它的发展历史之久远,甚至超越了俄罗斯方块(1988年电脑游戏化)。
这款游戏最初起源于日本,是个很难争辩的事实(我知道有人反对,但笔者确实找不到什么有力的反对证据)。他由日本人(哎……)今川宏行在1981年创立游戏规则,并于1982年经日本软件公司Thinking Rabbit正式发布。比较遗憾的是,早期的推箱子并没有PC版,笔者在网络上搜索到的老版游戏也大多为90年以前的Mac OS下程式。
但说起真正令推箱子风靡于PC机的,却该感谢我们的台湾同胞李果兆先生。是他在1994年开发的仓库世家,才真正令推箱子游戏在世界各地大受推崇;仔细说来,推箱子这款小游戏之所以能有今时今日的声望与地位,固然有今川宏行的开创之功,但若说到贡献最大,承前启后的,则非中国台湾的李果兆先生莫属。
推箱子游戏的规则非常简单,就是用尽量少的推动或移动把所有箱子都推到目标点上。箱子只能推动而不能拉动;一次只能推动一个箱子。然而,尽管它的规则是很简单的,但对于不同难度的关卡,所需要的脑力却是截然不同的,有些关卡可能会花费您几个小时、几天甚至几个月的时间,也正是这种简单性和复杂性的结合,最终令推箱子类游戏风靡全球!
本回笔者在Blog中提供的,就是一款Java版推箱子游戏的简单实现。
笔者设定[上、下、左、右]为方向控制 ,[S]键为后退到上一步操作,[ESC]为重新开始当前关卡,点击键盘上对应关卡的数字键可以直接选关,需要注意的是笔者以HP限制了角色的移动次数,HP归0则挑战失败。
目前版本仅提供有5关,有需要者可参考同类游戏自行扩充,游戏源码在jar内。

 

下载地址1(由于google code维护,需要等此文发表的隔天才能开放下载):

 

下载地址2:

游戏截图:

 

00

 

01

 

02

 

核心代码:

Sokoban.java

 

[java]
  1. package org.loon.game.simple.sokoban.control;  
  2. import java.awt.Color;  
  3. import java.awt.Font;  
  4. import java.awt.Graphics;  
  5. import java.awt.Image;  
  6. import java.awt.event.KeyEvent;  
  7. import org.loon.game.simple.sokoban.GraphicsUtils;  
  8. import org.loon.game.simple.sokoban.LSystem;  
  9. import org.loon.game.simple.sokoban.SimpleControl;  
  10. /** 
  11.  * Copyright 2008 - 2009 
  12.  *  
  13.  * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
  14.  * use this file except in compliance with the License. You may obtain a copy of 
  15.  * the License at 
  16.  *  
  17.  * http://www.apache.org/licenses/LICENSE-2.0 
  18.  *  
  19.  * Unless required by applicable law or agreed to in writing, software 
  20.  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
  21.  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
  22.  * License for the specific language governing permissions and limitations under 
  23.  * the License. 
  24.  *  
  25.  * @project loonframework 
  26.  * @author chenpeng 
  27.  * @email <a title="" href="http://hi.baidu.com/ceponline" mce_href="http://hi.baidu.com/ceponline" target="_blank">ceponline</a>@yahoo.com.cn 
  28.  * @version 0.1 
  29.  */  
  30. public class Sokoban extends SimpleControl {  
  31.     /** 
  32.      *  
  33.      */  
  34.     private static final long serialVersionUID = 1L;  
  35.     private Image backImage = GraphicsUtils.loadImage("image/back1.jpg");  
  36.     private Image screenImage;  
  37.     // 墙壁图  
  38.     private Image floorImage[];  
  39.     // 角色精灵  
  40.     private RpgSprite sprite;  
  41.     // 窗体显示图  
  42.     private Graphics screen;  
  43.     private String message = "按下 [Enter] 开始进行游戏";  
  44.     private String m_stageName[] = { "关卡1""关卡2""关卡3""关卡4""关卡5""关卡6",  
  45.             "关卡7" };  
  46.     private int CS = 32;  
  47.     private int maxX, maxY, comps;  
  48.     private int stageNo;  
  49.     private boolean complete[];  
  50.     private boolean boxMove[][];  
  51.     private int hp[];  
  52.     private int stageStates[][][];  
  53.     private int ons[][];  
  54.     private int role[];  
  55.     private int rolex[];  
  56.     private int roley[];  
  57.     private int mapx[];  
  58.     private int mapy[];  
  59.     private int sleep = 0;  
  60.     private boolean succeed = false;  
  61.     private Stage stage;  
  62.     public Sokoban(Stage stage) {  
  63.         this.stage = stage;  
  64.         this.floorImage = new Image[4];  
  65.         this.sprite = new RpgSprite("image/role1.gif");  
  66.         this.maxX = 16;  
  67.         this.maxY = 13;  
  68.         this.comps = 0;  
  69.         this.complete = new boolean[stage.getMaxStageNo()];  
  70.         this.boxMove = new boolean[stage.getMaxStageNo()][1500];  
  71.         this.ons = new int[stage.getMaxStageNo()][1500];  
  72.         this.hp = new int[stage.getMaxStageNo()];  
  73.         this.stageStates = new int[stage.getMaxStageNo()][maxY][maxX];  
  74.         this.role = new int[stage.getMaxStageNo()];  
  75.         this.rolex = new int[stage.getMaxStageNo()];  
  76.         this.roley = new int[stage.getMaxStageNo()];  
  77.         this.mapx = new int[stage.getMaxStageNo()];  
  78.         this.mapy = new int[stage.getMaxStageNo()];  
  79.         for (int j = 0; j < 4; j++) {  
  80.             floorImage[j] = GraphicsUtils.loadImage("image/back" + (j + 1)  
  81.                     + ".gif");  
  82.         }  
  83.         this.screenImage = GraphicsUtils.createImage(CS * maxX + CS, CS  
  84.                 * (maxY + 1) + 32true);  
  85.         this.screen = screenImage.getGraphics();  
  86.         for (stageNo = 0; stageNo < stage.getMaxStageNo(); stageNo++) {  
  87.             this.setupStage();  
  88.         }  
  89.         this.stageNo = -1;  
  90.         // 开场界面  
  91.         this.openDraw();  
  92.     }  
  93.     /** 
  94.      * 刷新关卡 
  95.      *  
  96.      */  
  97.     public synchronized void reset(int stageNo) {  
  98.         this.stageNo = stageNo;  
  99.         this.stage.getMode()[stageNo] = 1;  
  100.         this.message = null;  
  101.         // 设定关卡  
  102.         this.setupStage();  
  103.         // 重绘背景  
  104.         this.background();  
  105.         // 重绘游戏屏幕  
  106.         this.drawScreen();  
  107.     }  
  108.     /** 
  109.      * 绘制屏幕背景 
  110.      *  
  111.      */  
  112.     public synchronized void background() {  
  113.         screen.drawImage(backImage, 00null);  
  114.         screen.setColor(Color.black);  
  115.         screen.fillRect(0, LSystem.HEIGHT - 40, LSystem.WIDTH, 40);  
  116.     }  
  117.     /** 
  118.      * 绘制屏幕图像 
  119.      *  
  120.      */  
  121.     public synchronized void drawScreen() {  
  122.         if (stageNo >= stage.getMaxStageNo()) {  
  123.             stageNo = 0;  
  124.         }  
  125.         for (int i = 0; i < mapy[stageNo]; i++) {  
  126.             for (int j = 0; j < mapx[stageNo];) {  
  127.                 switch (stageStates[stageNo][i][j]) {  
  128.                 case 2:  
  129.                 case 3:  
  130.                 case 4:  
  131.                 case 5:  
  132.                     screen.drawImage(floorImage[1], moveX(j), moveY(i), null);  
  133.                 default:  
  134.                     j++;  
  135.                     break;  
  136.                 }  
  137.             }  
  138.         }  
  139.         for (int n = 0; n < mapy[stageNo]; n++) {  
  140.             for (int l = 0; l < mapx[stageNo]; l++)  
  141.                 switch (stageStates[stageNo][n][l]) {  
  142.                 case 1:  
  143.                     screen.drawImage(floorImage[0], moveX(l), moveY(n), null);  
  144.                     screen.setColor(new Color(3200));  
  145.                     screen.drawLine(moveX(l), moveY(n + 1), moveX(l) + CS - 1,  
  146.                             moveY(n + 1));  
  147.                     if (l == 0 || l > 0 && stageStates[stageNo][n][l - 1] != 1) {  
  148.                         screen.setColor(new Color(16012896));  
  149.                         screen.drawLine(moveX(l), moveY(n) + 1, moveX(l),  
  150.                                 moveY(n) + CS - 2);  
  151.                     }  
  152.                     if (l == mapx[stageNo] - 1 || l < mapx[stageNo] - 1  
  153.                             && stageStates[stageNo][n][l + 1] != 1) {  
  154.                         screen.setColor(new Color(726464));  
  155.                         screen.drawLine(moveX(l) + CS - 1, moveY(n), moveX(l)  
  156.                                 + CS - 1, moveY(n) + CS - 2);  
  157.                     }  
  158.                     break;  
  159.                 case 2:  
  160.                 case 3:  
  161.                 case 4:  
  162.                     switch (stageStates[stageNo][n][l]) {  
  163.                     default:  
  164.                         break;  
  165.                     case 2:  
  166.                     case 3:  
  167.                         screen.drawImage(floorImage[3], moveX(l), moveY(n),  
  168.                                 null);  
  169.                         break;  
  170.                     case 4:  
  171.                         break;  
  172.                     }  
  173.                     if (stageStates[stageNo][n][l] != 3)  
  174.                         screen.drawImage(floorImage[2], moveX(l), moveY(n),  
  175.                                 null);  
  176.                     break;  
  177.                 default:  
  178.                     break;  
  179.                 }  
  180.         }  
  181.         // System.out.println(role[stageNo]);  
  182.         screen.drawImage(sprite.getOnlyMove(role[stageNo]),  
  183.                 moveX(rolex[stageNo]), moveY(roley[stageNo]), null);  
  184.         if (stageStates[stageNo][roley[stageNo]][rolex[stageNo]] == 4) {  
  185.             screen.drawImage(floorImage[2], moveX(rolex[stageNo]),  
  186.                     moveY(roley[stageNo]), null);  
  187.         }  
  188.         setupDisplay();  
  189.     }  
  190.     /** 
  191.      * 定位到实际的X座标 
  192.      *  
  193.      * @param i 
  194.      * @return 
  195.      */  
  196.     public int moveX(int i) {  
  197.         return (CS * ((maxX - mapx[stageNo]) + 1)) / 2 + CS * i;  
  198.     }  
  199.     /** 
  200.      * 定位到实际的Y座标 
  201.      *  
  202.      * @param i 
  203.      * @return 
  204.      */  
  205.     public int moveY(int i) {  
  206.         return (CS * ((maxY - mapy[stageNo]) + 1)) / 2 + CS * i;  
  207.     }  
  208.     /** 
  209.      * 执行操作 
  210.      *  
  211.      */  
  212.     public synchronized void execute() {  
  213.         boolean flag = true;  
  214.         for (int i = 0; i < mapy[stageNo]; i++) {  
  215.             for (int j = 0; j < mapx[stageNo]; j++) {  
  216.                 if (stageStates[stageNo][i][j] == 4) {  
  217.                     flag = false;  
  218.                 }  
  219.             }  
  220.         }  
  221.         if (flag) {  
  222.             stage.getMode()[stageNo] = 3;  
  223.             complete[stageNo] = true;  
  224.         } else if (hp[stageNo] == 0) {  
  225.             stage.getMode()[stageNo] = 2;  
  226.         }  
  227.         comps = 0;  
  228.         for (int n = 0; n < stage.getMaxStageNo(); n++) {  
  229.             if (complete[n]) {  
  230.                 comps++;  
  231.             }  
  232.         }  
  233.     }  
  234.     /** 
  235.      * 键盘事件处理 
  236.      */  
  237.     public void keyPressed(KeyEvent e) {  
  238.         if (e.getKeyCode() == 10 && stageNo == -1) {  
  239.             // 开始关卡1  
  240.             reset(0);  
  241.         } else if (stageNo < 0) {  
  242.             return;  
  243.         }  
  244.         // 选关(默认为最大支持7关,更多请自行设定)  
  245.         if (e.getKeyCode() == 97 || e.getKeyCode() == 49) {  
  246.             stageNo = 0;  
  247.         } else if (e.getKeyCode() == 98 || e.getKeyCode() == 50) {  
  248.             stageNo = 1;  
  249.         } else if (e.getKeyCode() == 99 || e.getKeyCode() == 51) {  
  250.             stageNo = 2;  
  251.         } else if (e.getKeyCode() == 100 || e.getKeyCode() == 52) {  
  252.             stageNo = 3;  
  253.         } else if (e.getKeyCode() == 101 || e.getKeyCode() == 53) {  
  254.             stageNo = 4;  
  255.         } else if (e.getKeyCode() == 102 || e.getKeyCode() == 54) {  
  256.             stageNo = 5;  
  257.         } else if (e.getKeyCode() == 103 || e.getKeyCode() == 55) {  
  258.             stageNo = 6;  
  259.             // ESC,重新开始  
  260.         } else if (e.getKeyCode() == 27) {  
  261.             reset(stageNo);  
  262.         } else if (stage.getMode()[stageNo] == 1) {  
  263.             // 退步  
  264.             if (e.getKeyCode() == 83) {  
  265.                 nextStep(-1);  
  266.             }  
  267.             // 移动角色  
  268.             else if (e.getKeyCode() == 40) {  
  269.                 nextStep(0);  
  270.             } else if (e.getKeyCode() == 37) {  
  271.                 nextStep(1);  
  272.             } else if (e.getKeyCode() == 39) {  
  273.                 nextStep(2);  
  274.             } else if (e.getKeyCode() == 38) {  
  275.                 nextStep(3);  
  276.             } else {  
  277.                 return;  
  278.             }  
  279.         } else {  
  280.             return;  
  281.         }  
  282.         // 绘制背景  
  283.         background();  
  284.         // 绘制游戏画面  
  285.         drawScreen();  
  286.     }  
  287.     /** 
  288.      * 切换动作 
  289.      *  
  290.      * @param i 
  291.      */  
  292.     public synchronized void nextStep(final int i) {  
  293.         boxMove[stageNo][hp[stageNo] - 1] = false;  
  294.         switch (i) {  
  295.         case 0:  
  296.             if (stageStates[stageNo][roley[stageNo] + 1][rolex[stageNo]] < 2) {  
  297.                 return;  
  298.             }  
  299.             if (stageStates[stageNo][roley[stageNo] + 1][rolex[stageNo]] < 4) {  
  300.                 if (stageStates[stageNo][roley[stageNo] + 2][rolex[stageNo]] < 4) {  
  301.                     return;  
  302.                 }  
  303.                 stageStates[stageNo][roley[stageNo] + 1][rolex[stageNo]] += 2;  
  304.                 stageStates[stageNo][roley[stageNo] + 2][rolex[stageNo]] -= 2;  
  305.                 boxMove[stageNo][hp[stageNo] - 1] = true;  
  306.             }  
  307.             roley[stageNo]++;  
  308.             break;  
  309.         case 1:  
  310.             if (stageStates[stageNo][roley[stageNo]][rolex[stageNo] - 1] < 2) {  
  311.                 return;  
  312.             }  
  313.             if (stageStates[stageNo][roley[stageNo]][rolex[stageNo] - 1] < 4) {  
  314.                 if (stageStates[stageNo][roley[stageNo]][rolex[stageNo] - 2] < 4) {  
  315.                     return;  
  316.                 }  
  317.                 stageStates[stageNo][roley[stageNo]][rolex[stageNo] - 1] += 2;  
  318.                 stageStates[stageNo][roley[stageNo]][rolex[stageNo] - 2] -= 2;  
  319.                 boxMove[stageNo][hp[stageNo] - 1] = true;  
  320.             }  
  321.             rolex[stageNo]--;  
  322.             break;  
  323.         case 2:  
  324.             if (stageStates[stageNo][roley[stageNo]][rolex[stageNo] + 1] < 2) {  
  325.                 return;  
  326.             }  
  327.             if (stageStates[stageNo][roley[stageNo]][rolex[stageNo] + 1] < 4) {  
  328.                 if (stageStates[stageNo][roley[stageNo]][rolex[stageNo] + 2] < 4) {  
  329.                     return;  
  330.                 }  
  331.                 stageStates[stageNo][roley[stageNo]][rolex[stageNo] + 1] += 2;  
  332.                 stageStates[stageNo][roley[stageNo]][rolex[stageNo] + 2] -= 2;  
  333.                 boxMove[stageNo][hp[stageNo] - 1] = true;  
  334.             }  
  335.             rolex[stageNo]++;  
  336.             break;  
  337.         case 3:  
  338.             if (stageStates[stageNo][roley[stageNo] - 1][rolex[stageNo]] < 2) {  
  339.                 return;  
  340.             }  
  341.             if (stageStates[stageNo][roley[stageNo] - 1][rolex[stageNo]] < 4) {  
  342.                 if (stageStates[stageNo][roley[stageNo] - 2][rolex[stageNo]] < 4) {  
  343.                     return;  
  344.                 }  
  345.                 stageStates[stageNo][roley[stageNo] - 1][rolex[stageNo]] += 2;  
  346.                 stageStates[stageNo][roley[stageNo] - 2][rolex[stageNo]] -= 2;  
  347.                 boxMove[stageNo][hp[stageNo] - 1] = true;  
  348.             }  
  349.             roley[stageNo]--;  
  350.             break;  
  351.         default:  
  352.             if (hp[stageNo] == stage.getMaxHp()[stageNo]) {  
  353.                 return;  
  354.             }  
  355.             switch (ons[stageNo][hp[stageNo]]) {  
  356.             case 0:  
  357.                 if (boxMove[stageNo][hp[stageNo]]) {  
  358.                     stageStates[stageNo][roley[stageNo] + 1][rolex[stageNo]] += 2;  
  359.                     stageStates[stageNo][roley[stageNo]][rolex[stageNo]] -= 2;  
  360.                 }  
  361.                 roley[stageNo]--;  
  362.                 break;  
  363.             case 1:  
  364.                 if (boxMove[stageNo][hp[stageNo]]) {  
  365.                     stageStates[stageNo][roley[stageNo]][rolex[stageNo] - 1] += 2;  
  366.                     stageStates[stageNo][roley[stageNo]][rolex[stageNo]] -= 2;  
  367.                 }  
  368.                 rolex[stageNo]++;  
  369.                 break;  
  370.             case 2:  
  371.                 if (boxMove[stageNo][hp[stageNo]]) {  
  372.                     stageStates[stageNo][roley[stageNo]][rolex[stageNo] + 1] += 2;  
  373.                     stageStates[stageNo][roley[stageNo]][rolex[stageNo]] -= 2;  
  374.                 }  
  375.                 rolex[stageNo]--;  
  376.                 break;  
  377.             default:  
  378.                 if (boxMove[stageNo][hp[stageNo]]) {  
  379.                     stageStates[stageNo][roley[stageNo] - 1][rolex[stageNo]] += 2;  
  380.                     stageStates[stageNo][roley[stageNo]][rolex[stageNo]] -= 2;  
  381.                 }  
  382.                 roley[stageNo]++;  
  383.                 break;  
  384.             }  
  385.             break;  
  386.         }  
  387.         if (i != -1) {  
  388.             hp[stageNo]--;  
  389.             ons[stageNo][hp[stageNo]] = i;  
  390.         }  
  391.         role[stageNo] = ons[stageNo][hp[stageNo]];  
  392.         if (i == -1) {  
  393.             hp[stageNo]++;  
  394.         }  
  395.         execute();  
  396.     }  
  397.     /** 
  398.      * 开场画面 
  399.      *  
  400.      */  
  401.     public synchronized void openDraw() {  
  402.         background();  
  403.         for (int i = 0; i < 5; i++) {  
  404.             for (int j = 0; j < maxX + 1; j++) {  
  405.                 screen.drawImage(floorImage[0], CS * j,  
  406.                         (CS * i + CS / 2 * maxY) - CS * 2null);  
  407.             }  
  408.         }  
  409.         GraphicsUtils.setAntialias(screen, true);  
  410.         String mes = "怪蜀黍传说 - 勇者推魔王";  
  411.         screen.setFont(new Font("华文新魏"135));  
  412.         GraphicsUtils.drawStyleString(screen, mes, (CS * maxX - screen  
  413.                 .getFontMetrics().stringWidth(mes)) / 2 + 13,  
  414.                 (CS * maxY) / 2 + 25, Color.black, Color.orange);  
  415.         mes = "Java版搬箱子游戏开发入门示例 - 0.1.0";  
  416.         screen.setFont(new Font("华文新魏"030));  
  417.         GraphicsUtils.drawStyleString(screen, mes, (CS * maxX - screen  
  418.                 .getFontMetrics().stringWidth(mes)) / 2 + 13,  
  419.                 (CS * (maxY + 2)) / 2 - 55, Color.black, Color.white);  
  420.         GraphicsUtils.setAntialias(screen, false);  
  421.         setupDisplay();  
  422.     }  
  423.     /** 
  424.      * 绘图接口实现 
  425.      */  
  426.     public synchronized void draw(Graphics g) {  
  427.         g.drawImage(screenImage, 00null);  
  428.         if (succeed) {  
  429.             if (sleep == 100) {  
  430.                 // 进入下一关  
  431.                 reset(++stageNo);  
  432.                 succeed = false;  
  433.                 sleep = 0;  
  434.             }  
  435.             sleep++;  
  436.         }  
  437.     }  
  438.     /** 
  439.      * 设置基本数据 
  440.      *  
  441.      */  
  442.     public void setupStage() {  
  443.         for (int i = 0; i < maxY; i++) {  
  444.             for (int j = 0; j < maxX; j++) {  
  445.                 stageStates[stageNo][i][j] = 0;  
  446.             }  
  447.         }  
  448.         mapx[stageNo] = stage.getConf()[stageNo][0];  
  449.         mapy[stageNo] = stage.getConf()[stageNo][1];  
  450.         rolex[stageNo] = stage.getConf()[stageNo][2];  
  451.         roley[stageNo] = stage.getConf()[stageNo][3];  
  452.         for (int n = 0; n < mapy[stageNo]; n++) {  
  453.             for (int l = 0; l < mapx[stageNo]; l++) {  
  454.                 stageStates[stageNo][n][l] = stage.getMapData()[stageNo][n][l];  
  455.             }  
  456.         }  
  457.         hp[stageNo] = stage.getMaxHp()[stageNo];  
  458.         role[stageNo] = 0;  
  459.         for (int i1 = 0; i1 < stage.getMaxHp()[stageNo]; i1++) {  
  460.             ons[stageNo][i1] = 0;  
  461.         }  
  462.         for (int j1 = 0; j1 < stage.getMaxHp()[stageNo]; j1++) {  
  463.             boxMove[stageNo][j1] = false;  
  464.         }  
  465.     }  
  466.     /** 
  467.      * 设置显示 
  468.      *  
  469.      */  
  470.     public void setupDisplay() {  
  471.         if (message == null) {  
  472.             screen.setFont(new Font(LSystem.FONT, 012));  
  473.             int size = 0;  
  474.             for (int j = 0; j < stage.getMaxStageNo(); j++) {  
  475.                 if (complete[j]) {  
  476.                     screen.setColor(Color.gray);  
  477.                 } else {  
  478.                     screen.setColor(Color.white);  
  479.                 }  
  480.                 if (j == stageNo) {  
  481.                     if (complete[j]) {  
  482.                         screen.setColor(Color.magenta);  
  483.                     } else {  
  484.                         screen.setColor(Color.cyan);  
  485.                     }  
  486.                 }  
  487.                 screen.drawString(m_stageName[j], size = (10 + (screen  
  488.                         .getFontMetrics().stringWidth("关卡0") + 20)  
  489.                         * j), LSystem.HEIGHT - 50);  
  490.             }  
  491.             screen.setColor(Color.white);  
  492.             if (stageNo == -1) {  
  493.                 // 初始画面,无数据  
  494.             } else {  
  495.                 // 显示状态  
  496.                 if (hp[stageNo] == 0) {  
  497.                     screen.setColor(Color.red);  
  498.                 } else if (hp[stageNo] <= stage.getMaxHp()[stageNo] / 4) {  
  499.                     screen.setColor(Color.orange);  
  500.                 } else 

你可能感兴趣的文章
Intellij IDEA使用(四)—— 使用Intellij IDEA创建静态的web(HTML)项目
查看>>
Intellij IDEA使用(五)—— Intellij IDEA在使用中的一些其他常用功能或常用配置收集
查看>>
Intellij IDEA使用(六)—— 使用Intellij IDEA创建Java项目并配置jar包
查看>>
Eclipse使用(十)—— 使用Eclipse创建简单的Maven Java项目
查看>>
Eclipse使用(十一)—— 使用Eclipse创建简单的Maven JavaWeb项目
查看>>
Intellij IDEA使用(十三)—— 在Intellij IDEA中配置Maven
查看>>
面试题 —— 关于main方法的十个面试题
查看>>
集成测试(一)—— 使用PHP页面请求Spring项目的Java接口数据
查看>>
使用Maven构建的简单的单模块SSM项目
查看>>
Intellij IDEA使用(十四)—— 在IDEA中创建包(package)的问题
查看>>
FastDFS集群架构配置搭建(转载)
查看>>
HTM+CSS实现立方体图片旋转展示效果
查看>>
FFmpeg 命令操作音视频
查看>>
问题:Opencv(3.1.0/3.4)找不到 /opencv2/gpu/gpu.hpp 问题
查看>>
目的:使用CUDA环境变量CUDA_VISIBLE_DEVICES来限定CUDA程序所能使用的GPU设备
查看>>
问题:Mysql中字段类型为text的值, java使用selectByExample查询为null
查看>>
程序员--学习之路--技巧
查看>>
解决问题之 MySQL慢查询日志设置
查看>>
contOS6 部署 lnmp、FTP、composer、ThinkPHP5、docker详细步骤
查看>>
TP5.1模板布局中遇到的坑,配置完不生效解决办法
查看>>