91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4.07MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-31
  • 語言: Java
  • 標簽: 課程設計??

資源簡介

戰艦游戲設計課程報告.采用Java語言基于IDEA開發工具完成,有音效,使用的是自定義的線程,信能不太好,可以自己下載下來使用線程池優化一下.源碼也包含在壓縮包里面了,有直接使用Maven打的jar包運行.

資源截圖

代碼片段和文件信息

package?com.game.submarine.action;

import?com.game.submarine.hit.Blast;
import?com.game.submarine.panel.MyPanel;
import?com.game.submarine.ship.Submarine;
import?com.game.submarine.ship.WarShip;

import?javax.swing.*;
import?java.awt.*;
import?java.net.URL;
/**
?*?title:?com.game.submarine.action
?*?@author:?lixing
?*?date:?2018/6/2?15:06
?*?description:潛艇發射魚雷對象
?*/
public?class?Torpedo?implements?Runnable?{
????private?MyPanel?panel;
????private?WarShip?ship;
????private?Submarine?sm;
????/**?默認長度和寬度?參數來自圖片*/
????private?int??weight?=?5;
????private?int??height?=?5;
????/**?位置xy*/
????private?int??X;
????private?int??Y;
????/**?移動距離*/
????private?int??dy?=?1;
????/**?運行標記*/
????public???boolean?flag?=?false;
????private?Image?image;
????private?Blast?blast;

????public?Torpedo(MyPanel?p?WarShip?ws?Submarine?sm)
????{
????????this.panel?=?p;
????????this.ship??=?ws;
????????this.sm????=?sm;
????????URL?url=Torpedo.class.getResource(“/images/魚雷.png“);
????????image?=?Toolkit.getDefaultToolkit().getImage(url);
????????image?=?new?ImageIcon(image).getImage();
????????this.weight?=?image.getWidth(panel);
????????this.height?=?image.getHeight(panel);
????????this.X?????=?this.sm.getX()?+?this.weight/?2;
????????this.Y?????=?this.sm.getY();

????}
????public?void?drawTorpedo(Graphics2D?g)
????{
????????g.drawImage(image?this.X?this.Y?panel);
????}

????public?void?upMove()
????{
????????this.Y?-=?this.dy;
????????if(this.Y?<=?150)
????????{
????????????this.hitting();
????????????this.flag?=?true;
????????}
????????if(this.sm.flag?==?true)
????????{
????????????if(this.Y?????????????{
????????????????this.flag?=?true;
????????????}
????????}
????}
????@Override
????public?void?run()
????{
????????while(!flag)
????????{
????????????this.upMove();
????????????if(this.panel.isStop()?==?true)
????????????{
????????????????synchronized(MyPanel.subLock)
????????????????{
????????????????????try
????????????????????{
????????????????????????MyPanel.subLock.wait();
????????????????????}
????????????????????catch(Exception?e)
????????????????????{
????????????????????????e.printStackTrace();
????????????????????????this.flag?=?true;
????????????????????}
????????????????}

????????????}

????????????try
????????????{
????????????????Thread.sleep(10);
????????????}
????????????catch(Exception?e)
????????????{

????????????????e.printStackTrace();
????????????????this.flag?=?true;
????????????}
????????}
????}

????/**?判斷是否擊中戰艦*/
????public?void?hitting()
????{
????????if(this.X?>?(this.ship.getBeginX()?-?this.weight)?&&?this.X?????????{

????????????int?num?=?this.panel.getLiveNum();

????????????blast??=?new?Blast(this.ship.getBeginX()?+?this.ship.getWidth()?/2?this.ship.getBeginY()?+?this.ship.getHeight()?/?2);
????????????Thread?t?=?new?Thread(blast);
????????????thi

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-02-09?13:41??戰艦游戲設計課程報告\
?????目錄???????????0??2019-02-09?13:41??戰艦游戲設計課程報告\fight\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\.idea\
?????文件?????????622??2018-06-11?21:19??戰艦游戲設計課程報告\fight\.idea\compiler.xml
?????文件?????????654??2018-06-13?18:47??戰艦游戲設計課程報告\fight\.idea\encodings.xml
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\.idea\inspectionProfiles\
?????文件????????1551??2018-06-09?13:27??戰艦游戲設計課程報告\fight\.idea\inspectionProfiles\Project_Default.xml
?????文件?????????457??2018-06-09?11:15??戰艦游戲設計課程報告\fight\.idea\misc.xml
?????文件?????????250??2018-06-09?11:15??戰艦游戲設計課程報告\fight\.idea\modules.xml
?????文件???????67066??2018-06-17?12:14??戰艦游戲設計課程報告\fight\.idea\workspace.xml
?????文件????????1134??2018-06-12?23:36??戰艦游戲設計課程報告\fight\fight.iml
?????文件????????2785??2018-06-13?21:02??戰艦游戲設計課程報告\fight\pom.xml
?????文件????????1027??2019-02-09?13:41??戰艦游戲設計課程報告\fight\readme.md
?????文件????????1018??2018-06-15?11:16??戰艦游戲設計課程報告\fight\readme.md.bak
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\game\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\action\
?????文件????????4160??2018-06-15?16:04??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\action\Torpedo.java
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\bumb\
?????文件????????3029??2018-06-16?18:36??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\bumb\Bumb.java
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\button\
?????文件????????3126??2018-06-13?12:04??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\button\MyButton.java
?????目錄???????????0??2019-02-09?13:40??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\dialog\
?????文件????????6574??2018-06-16?19:25??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\dialog\HelpDialog.java
?????文件????????7013??2018-06-15?12:49??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\dialog\InfoDialog.java
?????文件???????10000??2018-06-15?12:49??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\dialog\InputDialog.java
?????文件????????4102??2018-06-15?12:49??戰艦游戲設計課程報告\fight\src\main\java\com\game\submarine\dialog\MyDialog.java
............此處省略150個文件信息

評論

共有 條評論