资源简介
纯java游戏-植物大战僵尸源码,采用java的Swing组件以及java线程实现,经本人测试有点小卡,不过功能都实现了,我也是网上搜索好久收集到了,分享啦!

代码片段和文件信息
package plantvsplant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import plantvsplant.entity.Cell;
import plantvsplant.entity.Corpse;
import plantvsplant.entity.Grid;
import plantvsplant.entity.Plant;
import plantvsplant.tool.BulletMoveThread;
import plantvsplant.tool.CarThread;
import plantvsplant.tool.CorpseMoveThread;
import plantvsplant.tool.MoneyEnoughThread;
import plantvsplant.tool.ProduceBullet;
import plantvsplant.tool.SunAdd;
import plantvsplant.tool.SunAutoProduceThread;
import plantvsplant.tool.SunflowerProduceThread;
import plantvsplant.tool.Timer;
import plantvsplant.tool.plantTrainThread;
import plantvsplant.win.IndexWin;
import plantvsplant.win.MyLabel;
import plantvsplant.win.Win;
public class Controller {
private Win win;
private Grid grid;
private IndexWin indexwin;
private int x;
private int y;
private int length=28;
private String plantType = “00111“;
private Timer timer;
private int sunValue;
private int corpseNum;
private boolean uproot=false;//断定 能够挖除植物 0可以挖除
private int operation = 0;//0添加植物 1铲除植物
private MoneyEnoughThread moneyEnoughThread;
private Map carRunList=new HashMap();
private Map bulletList=new HashMap();
private SunAutoProduceThread sunAutoProduceThread;
private Map plantList=new HashMap();
private Map carList=new HashMap();
private Map corpseList=new HashMap();
private Map produceBulletTimer=new HashMap();
public Controller(){
indexwin=new IndexWin(this);
}
public void start(){
SunAdd.stop=false;
this.x=15;
this.y=80;
grid=new Grid(this.xthis.y);
sunValue=50;
win=Win.getWin(this);
timer=new Timer(this);
//grid.start();
indexwin.setVisible(false);
sunAutoProduceThread = new SunAutoProduceThread(this);
moneyEnoughThread = new MoneyEnoughThread(this);
win.toShow();
putSunValue(0);
timer.start();
sunAutoProduceThread.start();
moneyEnoughThread.start();
grid.getBoard()[1][0]=“31111“;
grid.getBoard()[4][0]=“31111“;
grid.getBoard()[7][0]=“31111“;
grid.getBoard()[10][0]=“31111“;
grid.getBoard()[13][0]=“31111“;
corpseNum=grid.getNum();
}
public void newCorpseThread(){
for (int i = 0; i < grid.getBoard().length; i++) {
if(“11121314“.contains(grid.getBoard()[i][length-1].substring(02))&&
corpseList.get(grid.getBoard()[i][length-1])==null){
corpseList.put(grid.getBoard()[i][length-1] new CorpseMoveThread(thisi length-1));
corpseList.get(grid.getBoard()[i][length-1]).start();
}
}
}
public int moveBullet(int xint y){
if(y+1==length-1&&grid.getBoard()[x][y].equals(“21bullet“)){
grid.g
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-11-14 14:36 游戏-植物大战僵尸\
目录 0 2014-11-14 14:32 游戏-植物大战僵尸\plantVScorpse\
文件 226 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\.classpath
文件 372 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\.project
目录 0 2012-06-16 07:05 游戏-植物大战僵尸\plantVScorpse\.settings\
文件 88 2011-10-10 11:06 游戏-植物大战僵尸\plantVScorpse\.settings\org.eclipse.core.resources.prefs
目录 0 2012-06-16 07:05 游戏-植物大战僵尸\plantVScorpse\bin\
目录 0 2012-06-16 07:05 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\
目录 0 2012-06-16 07:05 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\
文件 2479 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\1.jpg
文件 2882 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\2.jpg
文件 2889 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\3.jpg
文件 2829 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\4.jpg
文件 2666 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\5.jpg
文件 2893 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\6.jpg
文件 2886 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\7.jpg
文件 2673 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\8.jpg
文件 18645 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\card\cardboard.png
文件 1861 2011-10-13 16:11 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\Controller$1.class
文件 876 2011-10-13 16:11 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\Controller$2.class
文件 1205 2011-10-13 16:11 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\Controller$3.class
文件 19449 2011-10-13 16:11 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\Controller.class
目录 0 2012-06-16 07:05 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\
文件 12968 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\0440011332-3.png
文件 16209 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\04400121322-3.png
文件 9957 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\11.png
文件 12229 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\22.png
文件 7787 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\231641391097.jpg
文件 8949 2011-09-30 15:12 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\corpsel\33.png
目录 0 2012-06-16 07:05 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\entity\
文件 1565 2011-10-13 16:11 游戏-植物大战僵尸\plantVScorpse\bin\plantvsplant\entity\Cell.class
............此处省略142个文件信息
相关资源
- 微博系统(Java源码,servlet+jsp),适
- 即时通讯系统JAVA源码
- 自动出题系统(java 课程设计)
- Java操作Oracle数据库-多线程.rar
- 12306抢票程序java源码
- 李兴华java源码笔记
- Java酒店管理系统毕业设计含文档.ra
- JAVA潜艇大战小游戏源码
- 仿照植物大战僵尸java源码
- java源码包4
- java源码包3
- B/S 公交管理系统 Java源码 eclipse工程
- 经纬度计算距离、方位角等java源码
- 重构到设计模式的经典案例,超完美
- JSP毕业设计作业:奖学金评定系统J
- 基于java的图书管理系统源码Java源码
- 基于CS系统的CRM客户关系型管理系统
- java源码 亲测java 酒店管理系统(含
- 表白墙Java源码
- Java 界面漂亮的打字软件源码.rar
- Java界面华丽的跳棋游戏.rar
- 音乐网站javaweb源码.rar
- 课程设计基于GUI的FTP客户端JAVA源码
- Java超市购物进销存系统含Java源码完整
- 学院管理系统完整java源码
- Java版跳棋游戏源代码
- Java源码 吃豆豆 俄罗斯方块 扫雷 计算
- 仿跳一跳Java源码
- 电力规约IEC608705/DNP3 Java源码
- 航空订票系统java源码
评论
共有 条评论