飞机大战java源代码.docx
- 文档编号:1436104
- 上传时间:2022-10-22
- 格式:DOCX
- 页数:5
- 大小:14.67KB
飞机大战java源代码.docx
《飞机大战java源代码.docx》由会员分享,可在线阅读,更多相关《飞机大战java源代码.docx(5页珍藏版)》请在冰豆网上搜索。
飞机大战java源代码
Documentserialnumber【KK89K-LLS98YT-SS8CB-SSUT-SST108】
飞机大战java源代码
packagecom;
importclassPlane{
ImagefeijiImage=null;
intx=300;
inty=700;
intlifeCount=5;
publicPlane(){
try{
feijiImage=.getResourceAsStream("images/"));
}catch(IOExceptione){
();
}
}
publicvoiddraw(Graphicsg){
etResourceAsStream("images/"));
}catch(IOExceptione){
();
}
}
publicvoiddraw(Graphicsg){
etResourceAsStream("images/"));
}catch(IOExceptione){
();
}
}
intbgY1=0;
intbgY2=-600;
intfireTime=0;
booleanflag=false;
publicvoiddraw(Graphicsg){
tart();
etResourceAsStream("images/"));
}catch(IOExceptione){
();
}
}
publicvoiddraw(Graphicsg){
etResourceAsStream("images/diji_"+r+".png"));
}catch(IOExceptione){
();
}
}
publicvoiddraw(Graphicsg){
etResourceAsStream("images/"));
}catch(IOExceptione){
();
}
}
publicvoiddraw(Graphicsg){
etResourceAsStream("images/"));
}catch(IOExceptione){
();
}
}
publicvoiddraw(Graphicsg){
//画敌机子弹图片
(zidanImage,x,y,null);
//移动
();
}
publicvoidmove(){
if(fangxiang==0){
//下
y=y+2;
}elseif(fangxiang==1){
//左
x=x-2;
}elseif(fangxiang==2){
//右
x=x+2;
}elseif(fangxiang==3){
//左下
x=x-2;
y=y+2;
}elseif(fangxiang==4){
//右下
x=x+2;
y=y+2;
}
}
publicRectanglegetRectangle(){
returnnewRectangle(x,y,(null),(null));
}
}
packagecom;
import游戏开始之前
publicclassBefore{
Imagebg=null;
Imagewfeiji=null;
Imagekdiji1=null;
Imagekdiji2=null;
Imagekdiji3=null;
publicBefore(){
try{
bg="images/"));
wfeiji="images/"));
kdiji1="images/"));
kdiji2="images/"));
kdiji3="images/"));
}catch(IOExceptione){
();
}
}
inttime=0;
publicvoiddraw(Graphicsg){
if==1){
//画妹妹
(bg,0,0,null);
(wfeiji,260,600,null);
(kdiji1,200,50,null);
(kdiji1,400,50,null);
(kdiji1,150,480,null);
(kdiji1,400,480,null);
(kdiji2,100,200,null);
(kdiji2,300,100,null);
(kdiji2,480,200,null);
(kdiji3,300,300,null);
(kdiji3,70,400,null);
(kdiji3,510,400,null);
}
//画回车符
time++;
;
(newFont("幼圆",,30));
if(time<=10){
("[Enter]>>",50,750);
}elseif(time<=20){
("[Enter]>>",50,750);
}elseif(time<=30){
("[Enter]>>",50,750);
if(time==30){
time=0;
}
}
}
publicvoidkeyPressed(KeyEvente){
intkeyCode=();
if(keyCode=={
=1;
}
if(keyCode==||keyCode==){
=;//1~2互换
}
}
publicvoidkeyReleased(KeyEvente){
}
}
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 飞机 大战 java 源代码