傻大方


首页 > 学习 >

基于|基于java的游戏坦克大战论文( 四 )



按关键词阅读: java 基于 论文 大战 坦克 游戏



20、方法对我的思想产生了极大的影响 。
我的动手能力和独立解决问题的能 力得到了很大的锻炼和提高 。
我还要感谢学校提供这次毕业设计的机会 , 让我在学业即将结束的时候有认 识自己的机会 , 意识到自己的优势和不足 , 在这次毕业设计中明白了责任的重要 性 , 从而提高了自己的责任心 。
最后 , 感谢答辩组对我的毕业设计的考核 , 如能够得到答辩老师们的认可 ,即是对我的学习和工作最大的鼓励 。
你们的客观评价和建议一定牢记于心 , 在今 后的工作中 , 更加严格要求自己 。
附录一 坦克大战中的类 敌人坦克类 package myTankGame;
import java.util.*;
import java.io.*;
import。

21、javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
class AePlayWave extends Thread private String filename;
public AePlayWave(String wavfile) filename =。

22、wavfile;
public void run() File soundFile = new File(filename);
AudioInputStream audioInputStream = null;
try audioInputStream = AudioSystem.getAudioInputStream(soundFile);
catch (Exception e1) e1.printStackTrace();
return;
AudioFormat format = audioInputStream.getFormat();
SourceDataLine auline = n 。

23、ull;
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
try auline = (SourceDataLine) AudioSystem.getLine(info);
auline.open(format);
catch (Exception e) e.printStackTrace();
return;
auline.start();
int nBytesRead = 0;
byte abData = https://www.renrendoc.com/paper/new byte512;
try while (nBytesRead != -1) nBytes 。

24、Read = audioInputStream.read(abData, 0, abData.length);
if (nBytesRead = 0) auline.write(abData, 0, nBytesRead);
catch (IOException e) e.printStackTrace();
return;
finally auline.drain();
auline.close();
/敌人坦克点和方向构成的对象类(记录点) class Node int x;
int y;
int direct;
public Node(int x,int y,int direct) th 。

25、is.x=x;
this.y=y;
this.direct=direct;
/记录类 , 同时可以保存玩家的设置 class Recorder /记录没关有多少敌人 private static int enNum=20;
/设置我有多少生命值 private static int myLife=3;
/记录总共消灭多少敌人 private static int allEnNum=0;
private static Vector ets=new Vector();
public static Vector getEts() return ets;
public static void setEts 。

26、(Vector ets) Recorder.ets = ets;
/从文件中恢复记录点 private static Vector nodes=new Vector();
/完成读取任务 public static Vector getNidesAndEnNums() try fr=new FileReader(d:TankGame.txt);
br=new BufferedReader(fr);
String n=br.readLine();
/将字符串转换成 int 型 allEnNum=Integer.parseInt(n);
while(n=br.readLine()!=null) S 。

27、tring xyz=n.split( );
Node node=new Node(Integer.parseInt(xyz0), Integer.parseInt(xyz1), Integer.parseInt(xyz2);
nodes.add(node);
catch (Exception e) / TODO Auto-generated catch block e.printStackTrace();
finally try br.close();
fr.close();
catch (IOException e) / TODO Auto-generated catch block e.p 。

28、rintStackTrace();
return nodes;
/把玩家击毁敌人坦克的数量保存到文件中 private static FileWriter fw=null;
private static BufferedWriter bw=null;
private static FileReader fr=null;
private static BufferedReader br=null;
/把玩家击毁敌人坦克数量保存到文件中 public static void keepRecording() try fw=new FileWriter(d:TankGame.txt);
bw=new。

29、BufferedWriter(fw);
bw.write(allEnNum+rn);
/+rn是要换行 catch (IOException e) / TODO Auto-generated catch block e.printStackTrace();
finally try bw.close();
fw.close();
catch (IOException e) / TODO Auto-generated catch block e.printStackTrace();
/从文件中读取记录 public static void getRecoring() try fr=new FileR 。

30、eader(d:TankGame.txt);
br=new BufferedReader(fr);
String n=br.readLine();
/将字符串转换成 int 型 allEnNum=Integer.parseInt(n);
catch (Exception e) / TODO Auto-generated catch block e.printStackTrace();
finally try br.close();
fr.close();
catch (IOException e) / TODO Auto-generated catch block e.printStackTr 。

31、ace();
/存盘退出后保存敌人坦克坐标 public static void keepRecAndEnemTank() try fw=new FileWriter(d:TankGame.txt);
bw=new BufferedWriter(fw);
bw.write(allEnNum+rn);
/+rn是要换行 /保存当前活着的敌人坦克坐标和方向 for(int i=0;
iets.size();
i+) /取出坦克 EnemyTank et=ets.get(i);


稿源:(未知)

【傻大方】网址:/a/2021/0621/0022536797.html

标题:基于|基于java的游戏坦克大战论文( 四 )


上一篇:幼儿园大班|幼儿园大班教学的总结范文

下一篇:鲁科版|鲁科版高中化学化学4(选修)第三章试题