没有合适的资源?快使用搜索试试~ 我知道了~
java坦克大战1.0版源代码,java坦克大战1.0版源代码,java坦克大战1.0版源代码
资源推荐
资源详情
资源评论
package
坦克大战
@author杨伟
@version
一、主程序
直接【】导入所有用到的类
import
import !
import"!#$#$
import"!#%&
import"!#%'(
import"!#%'()
import"!#%'($
publicclassextends%&implements
!*主程序启动
'+,+,-null
,,-null
%'()()-null 菜单栏
%'((-null菜单
%'($($-null子菜单
%'($($.-null
%'($($/-null
%'($($0-null
publicstaticvoid1#23#!4*
-new14
5
public14*
()-new%'()14
(-new%'(16游戏1464
(!'1774
($-new%'($16新游戏18464
($.-new%'($16继续游戏1464
($/-new%'($16存盘退出1464
($0-new%'($16退出游戏1464
($99 !1this4
($.99 !1this4
($/99 !1this4
($099 !1this4
($!91664
($.!91664
($/!916!"64
($0!916"64
(991($4
(991($.4
(991($/4
(991($04
()991(4
,-new ,14
99-new91,4
9!14
this!%'()1()4
this991,4
this!16坦克大战64
this!$$#11new
$#$16.:#644#$#144
this!;1<0=>.4
this! 1=4
this!?!;@1false4
this!A(!:1%&EXIT_ON_CLOSE4
this!B!@1true4
5
publicvoid,914*
if1#914C(!16644*
+,-new'+,1664
this1,4删除关卡面板
this991+,4
this99D+ !1+,4
99-new91+,4
9!14
this!B!@1true4开显示
5elseif1#914C(!16644*
+,-new'+,1664
99-new91+,4
9!14
this1,4
this991+,4
this99D+ !1+,4
this!B!@1true4
5elseif1#914C(!16!"644*
?9seteTankVec1+,B4是静态方法所以不
用 对象
?9saveGame14
+!exit14
5elseif1#914C(!16"644*
+!exit14
5
5
5
二、关卡面板类
Import
import&
import:!
import"!#%,
class ,extends%,implements?(@*关卡面板
类
int!-
publicvoid:1:!#4*
super:1#4
#E?1==0=/<4
if1!F.--4*
#!1yellow4
&+&-new&16楷体6=&BOLD=04
#!&1+&4
#9#16第一关6=0=.4
5
5
publicvoid(14*
while1true4*
try*
9sleep1<4控制闪烁时间
5catch1":4*5
!
this:14
5
5
5
三、我的面板类
import
import&
import:!
import$#
import,
import
importD+
importD+ !
import(B
import"!#%:,
import"!#%,
class'+,extends%,implements
D+ !=?(@*我的面板类
'++-null
'++-(用于双人玩
++-null
)(@(-null
":!":-null
int8(-/敌人坦克数量
BG+HB-newBG+H14
敌人坦克组,做成集合类
有了泛型,我们在集合类中添加对象的时候,就不用再强转了
BG":!H":B-newBG":!H14
BG HB-newBG H14
爆炸效果图片初始化
$#:(-null
$#:(.-null
$#:(/-null
public'+,1#!4*
if1!C(!16644*
+-new'+1>=/.I4设定玩家坦克出现的位置、
方向和颜色
+-'+1/=//4
+!A14
+!14
for1int-G8(4*
+-new+114JK=/4设定敌方
坦克出场位置、方向和颜色
+!A14
+!14
B991+4将敌方坦克加入敌方坦克集合、
并传回敌方坦克集合方法中
+1B4
@(-new
)(1+"=++/=4设定敌方坦克出场位置
99-new91+4
99.-new91@(4
9!14敌人坦克线程开启
9.!14敌人子弹线程开启
5
5elseif1!C(!16644*
+-new'+1>=/.I4设定玩家坦克出现的位置、
方向和颜色
+-'+1/=//4
+!A14
+!14
B-?9readGame14读取游戏记录
for1int-GB!;144*将记录的位置横纵坐标以
及方向给敌方坦克
-B#14
+-new+1"=+4
+!A194
+!14
+1B4
B991+4
@(-new
)(1+"=++/=4
99-new91+4
9!14敌人坦克线程开启
剩余24页未读,继续阅读
资源评论
讲文明的喜羊羊拒绝pua
- 粉丝: 2128
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于matlab主成分分析图像压缩重建系统代码14
- C语言《基于AT89C52单片机搭建的PID直流电机控制程序,主要用于Proteus电路仿真》+源代码
- C++《基于规划和汽车动力学的自动驾驶项目仿真(基于ROS的自动驾驶项目仿真,使用DWA路径规划算法和双PID控制器)》+源代码
- vos3000客户端2.1.7.03、2.1.8.05、2.1.9.07
- c++《用于船舶控制方法研究的3D船舶运动仿真软件》+源代码
- globalmapper24
- Python 小游戏 (贪吃蛇、五子棋、扫雷、俄罗斯方块)源码.zip
- Map data that can be used for 2D raster map path planning
- 关于电子技术数字电路的芯片模拟.zip
- 普中开发板proteus仿真电路V2.6
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功