資源簡介
坦克大戰中的功能豐富,通過多種圖片的方式渲染頁面背景??梢猿跏蓟婕倚彰?,可以選擇通關難度,以及等級等。

代碼片段和文件信息
package?Control;
import?java.awt.Graphics;
import?java.awt.Rectangle;
import?java.util.ArrayList;
import?javax.swing.ImageIcon;
import?javax.swing.JLabel;
import?Data.Data;
import?Veiw.GameArea;
import?Veiw.Gameframe;
import?model.BuleEnemy;
import?model.Bullet;
import?model.EnBullet;
import?model.Enemy;
import?model.PinkEnemy;
import?model.Player;
import?model.YellowEnemy;
/**
?*?
?*?爆炸的線程
?*?
?*/
public?class?BoomThread?extends?Thread?{
private?Gameframe?f;
public?BoomThread(Gameframe?f)?{
super();
this.f?=?f;
}
@Override
public?void?run()?{
int?hp=?Player.getHP();
????????while(true)?{
???????? JLabel?lab?=?new?JLabel(new?ImageIcon(“image/bz.png“));
??????????if(Data.pouse==0)?{
???????? ??for?(int?i?=?0;?i? Bullet?bullet=?Data.zdList.get(i);
???????? ??for?(int?j?=?0;?j? ??Enemy?enemy=Data.enemyList.get(j);
??Rectangle?rebullet?=new?Rectangle(bullet.getX()?bullet.getY()?15?15);
??Rectangle?reenemy?=new?Rectangle(enemy.getX()?enemy.getY()?40?40);
??if(rebullet.intersects(reenemy))?{
??Data.zdList.remove(bullet);
?int?enemyhp=?enemy.getHp();
?enemyhp-=30;
?enemy.setHp(enemyhp);
?System.out.println(enemy.getHp());
?if(enemyhp<0)?{
?boolean?is=??Data.enemyList.remove(enemy);
???????????????if(enemy.getType()==new?YellowEnemy().getType())?{
???????????? ???Data.count+=YellowEnemy.getCount();
???????????????}
???????????????if(enemy.getType()==new?BuleEnemy().getType())?{
???????????? ???Data.count+=BuleEnemy.getCount();
???????????????}
???????????????if(enemy.getType()==new?PinkEnemy().getType())?{
???????????? ???Data.count+=PinkEnemy.getCount();
???????????????}
??lab.setBounds(enemy.getX()?enemy.getY()?40?40);
??f.getGa().add(lab);
??if(is==true)?{
??Data.hit++;
??}
??}
??}
}
???????? ??} ??
???????? ??for?(int?i?=?0;?i? EnBullet?bullet=?Data.enzdList.get(i);
??Rectangle?rebullet?=new?Rectangle(bullet.getX()?bullet.getY()?15?15);
??Rectangle?reenemy?=new?Rectangle(Data.player.getX()?Data.player.getY()?40?40);
??if(rebullet.intersects(reenemy))?{
??Data.zdList.remove(bullet);
??lab.setBounds(Data.player.getX()?Data.player.getY()?40?40);
??Data.player.setX(200);
??Data.player.setY(560);
??hp--;
??Data.player.setHP(hp);
??System.out.println(hp);
??f.getGa().add(lab);
??}
}
???????? ??}
try?{
Thread.sleep(80);
}?catch?(InterruptedException?e)?{
e.printStackTrace();
}
f.getGa().remove(lab);
????????}
????????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????395??2020-08-13?14:53??TankGame\.classpath
?????文件????????364??2020-08-11?22:34??TankGame\.idea\$PROJECT_FILE$
?????文件????????168??2020-08-11?22:34??TankGame\.idea\compiler.xm
?????文件???????1000??2020-08-11?23:20??TankGame\.idea\encodings.xm
?????文件???????1559??2020-08-11?22:35??TankGame\.idea\misc.xm
?????文件????????263??2020-08-11?22:35??TankGame\.idea\modules.xm
?????文件??????85545??2020-08-11?22:35??TankGame\.idea\qaplug_profiles.xm
?????文件???????7878??2020-08-12?17:37??TankGame\.idea\workspace.xm
?????文件????????384??2020-08-03?10:23??TankGame\.project
?????文件?????????55??2020-08-13?15:14??TankGame\.settings\org.eclipse.core.resources.prefs
?????文件????????784??2020-08-13?14:53??TankGame\.settings\org.eclipse.jdt.core.prefs
?????文件???????2847??2020-08-14?08:33??TankGame\bin\Control\BoomThread.class
?????文件???????1255??2020-08-14?08:33??TankGame\bin\Control\BulletMoveThread.class
?????文件???????1141??2020-08-14?08:33??TankGame\bin\Control\EnemyBullet.class
?????文件???????1240??2020-08-14?08:33??TankGame\bin\Control\EnemyBulletMoveThread.class
?????文件???????1104??2020-08-14?08:33??TankGame\bin\Control\EnemyMoveThread.class
?????文件???????1121??2020-08-14?08:33??TankGame\bin\Control\EnemyoutThread.class
?????文件???????1042??2020-08-14?08:33??TankGame\bin\Control\EnmeyDirtion.class
?????文件???????2308??2020-08-14?08:33??TankGame\bin\Control\GameoverThread.class
?????文件???????1541??2020-08-14?08:33??TankGame\bin\Control\NextlevelThread.class
?????文件???????1749??2020-08-14?08:33??TankGame\bin\Control\Pla
?????文件???????1603??2020-08-14?13:48??TankGame\bin\Control\SelfThread.class
?????文件???????1311??2020-08-14?08:33??TankGame\bin\Control\StageThread.class
?????文件???????2379??2020-08-14?08:33??TankGame\bin\Control\StartAction.class
?????文件???????4542??2020-08-14?08:33??TankGame\bin\Data\Data.class
?????文件???????1248??2020-08-14?08:33??TankGame\bin\model\Bomb.class
?????文件???????1249??2020-08-14?08:33??TankGame\bin\model\Boold.class
?????文件???????2494??2020-08-14?08:33??TankGame\bin\model\BuleEnemy.class
?????文件???????3479??2020-08-14?08:33??TankGame\bin\model\Bullet.class
?????文件???????3383??2020-08-14?08:33??TankGame\bin\model\EnBullet.class
............此處省略106個文件信息
評論
共有 條評論