java手机游戏设计源代码 第15页
Y())&&(sbsz0==0))
{bossbullet0.setVisible(true);
bossbullet0.setPosition(sboss.getX()+45,sbos.
getY()+35); sbsz0=1;
}
if(sbsz0==1)
{bossbullet0.move(3,0); if(bossbullet0.getX()>getWidth()) {
sbsz0=0; } }if((sboss.getX()>c1.getX())&&((sboss.getY()+65)>c1.getY())&&(sbsz1==0))
{bossbullet1.setPosition(sboss.getX()+10,sboss.getY()+35); sbsz1=1; }
if(sbsz1==1) { bossbullet1.move(-3,0);
if(bossbullet1.getX()<0) {
bossbullet1.setVisible(false); sbsz1=0;}} if((sboss.getX()<c1.getX())&&((sboss.getX()+50)>(c1.getX()))&&(sboss.getY()>c1.getY())&&(sbsz2==0)) {
bossbullet2.setVisible(true);
bossbullet2.setPosition(sboss.getX()+25,sboss.getY());sbsz2=1; }if(sbsz2==1)
{bossbullet2.move(0,-4); if(bossbullet2.getY()<planepoup)
{bossbullet2.setVisible(false); sbsz2=0;
} }if((sboss.getX()<c1.getX())&&((sboss.getX()+50)>(c1.getX()))&&(sboss.getY()<c1.getY())&&(sbsz3==0))
{bossbullet0.setVisible(true); bossbullet1.setVisible(true); bossbullet2.setVisible(true);
bossbullet2.setPosition(sboss.getX()+10,sboss.getY()+25); bossbullet1.setPosition(sboss.getX()+30,sboss.getY()+50);
bossbullet0.setPosition(sboss.getX()+55,sboss.getY()+25); sbsz3=1; }
if(sbsz3==1) {bossbullet0.move(0,4);
bossbullet1.move(0,4); bossbullet2.move(0,4);
if(bossbullet0.getY()>planepo)
{
bossbullet0.setVisible(false);
bossbullet1.setVisible(false);
bossbullet2.setVisible(false); sbsz3=0;
}}} if((slife==80)) {
sboss.setImage(img("/pic/explosion.png"),32,32);sboss.setFrame(3);bossbullet0.setVisible(false); bossbullet1.setVisible(false);
bossbullet2.setVisible(false); jiangli=11;
slife=85; drawslife=0;
playerno=playerno+1; sbz=-1;//sbos sbpzbz=1; }
if((sboss.getY()==getHeight())){
sbz=-1; sbpzbz=1; drawadd=21;
}if(drawadd==21) {sboss.move(0,-3);
if(sboss.getY()<-65) {
sboss.setVisible(false); drawadd=31;
}}if(planert==1) {inputno=1;
pzbz=1; s2=65; c1.setImage(img("/pic/MyPlaneFrames.png"),24,24); c1.setFrame(0); c1.setVisible(true);
c1.setPosition(getWidth()/2,planepo+48);
planert=2;
}if(planert==2)
{c1.move(0,-2); if(c1.getY()<(planepo-24))
{System.out.println(c1.getY());
System.out.println(planepo-24);inputno=0;
s1=1;
planert=3; }if(c1.getY()>(planepo+24))
{ c1.move(0,-2); }}
et=System.currentTimeMillis();
if((et-st)<rate){try{ Thread.sleep(rate-(et-st));
}catch(Exception exp){} }
}}public void render(Graphics g)
{ g.setColor(255,255,255);
g.fillRect(0,0,getWidth(),getHeight());
lm.setViewWindow(0,0,getWidth(),getHeight()+10000); lm.paint(g,0,y1); if(over==1)
{ g.drawString("寒在杭州览桥上空因座机被击中,壮烈殉国,年",c1.getWidth()-24,60,0); g.drawString("1937年 8月14日,空军第4大队少尉飞行员刘思",c1.getWidth()-24,40,0); g.drawString("仅21岁",c1.getWidth()-24,80,0); inputno=1;
}g.drawString("37年8月14日 杭州览桥 战果:"+String.valueOf(huokebullet[0].rscore()+huokebullet[3].rscore()+huokebullet[6].rscore()),c1.getWidth()-24,c1.getHeight()-20,0);//
if(drawslife==1) {g.setColor(255,0,0);
g.fillRect(2,22,80,5);g.setColor(255,255,255);
g.fillRect(2,22,slife,5); }
if(playerno==3) {g.drawImage(img("/pic/playerbiaozhi.png"),170,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),195,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0); }if(playerno==2)
{g.drawImage(img("/pic/playerbiaozhi.png"),195,4,0);
g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0); }if(playerno==1) {
g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0); }if(playerno==4)
{g.drawImage(img("/pic/playerbiaozhi.png"),145,4,0);
g.drawImage(img("/pic/playerbiaozhi.png"),170,4,0);
g.drawImage(img("/pic/playerbiaozhi.png"),195,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0);g.setColor(255,0,0); }
if(jiangli==11){g.setColor(255,0,0);
g.drawString("援军到达",100,150,0);
if(sboss.getY()>planepo) {jiangli=20;
}} if(s1==1) {g.setColor(255,255,255);
g.fillRect(170,22,65,5); g.setColor(255,0,0);
g.fillRect(170,22,s2,5); g.drawString("无敌时间",124,18,0); drawadd=1; s2=s2-1;
if(s2==0) {pzbz=0; s1=2; }}
flushGraphics();}public void renderboss(Graphics g) {lm.setViewWindow(0,0,getWidth(),getHeight()); lm.paint(g,0,0); if(over==1)
{//c1.getHeight(),0); g.drawString("1937年 8月14日,空军第4大队少尉飞行员刘思",c1.getWidth()-24,40,0);
g.drawString("仅21岁",c1.getWidth()-24,80,0); inputno=1;
} g.setColor(255,0,0); g.fillRect(2,2,60,5);//
g.setColor(255,255,255); g.fillRect(2,2,bosslife,5);//
if((bossover==1)&&(c1.isVisible()))
{g.drawString("此处加览桥空战真实历史战果",c1.getWidth()-24,40,0); g.drawString("此处加览桥空战真实历史战果",c1.getWidth()-24,60,0); g.drawString("仅21岁",c1.getWidth()-24,80,0); }
if(playerno==4) {g.drawImage(img("/pic/playerbiaozhi.png"),145,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),170,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),195,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0);} if(playerno==3) {
g.drawImage(img("/pic/playerbiaozhi.png"),170,4,0);
g.drawImage(img("/pic/playerbiaozhi.png"),195,4,0); g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0);}if(playerno==2){ g.drawImage(img("/pic/playerbiaozhi.png"),195,4,0);
g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0);
}if(playerno==1){ g.drawImage(img("/pic/playerbiaozhi.png"),220,4,0); }
if(s1==1) { g.setColor(255,255,255);
g.fillRect(170,22,65,5);g.setColor(255,0,0);
g.fillRect(170,22,s2,5);g.drawString("无敌",124,18,0);s2=s2-1;if(s2==0)
{pzbz=0;s1=2;}}
flushGraphics();}
public void input(){ if(inputno==0)
{int keystate=getKeyStates();
if((keystate&UP_PRESSED)!=0){
moveUp();}
if((keystate&DOWN_PRESSED)!=0){
moveDown();}if((keystate&LEFT_PRESSED)!=0){ moveLeft();}
if((keystate&LEFT_PRESSED)==0){
c1.setFrame(0);}if((keystate&RIGHT_PRESSED)!=0){moveRight();}
if((keystate&FIRE_PRESSED)!=0){
for(int i=0;i<=6;i=i+3){
if(huokebullet[i].no==1){
for( int z=i;z<i+3;z++){
huokebullet[z].initBullets(z); huokebullet[z].no=huokebullet[z].bulletheight
}huokebullet[i].setfirstposition(c1.getX(),c1.getY(),i,huokebullet,img("/pic/bullet.png"));//
break;}}}}}private void moveDown() {
c1.move(0,4);
if((c1.getY()+c1.getHeight())>planepo)
{
c1.setPosition(c1.getX(),planepo-c1.getHeight());}}private void moveUp() {c1.move(0,-4);
if(c1.getY()<planepoup){ c1.setPosition(c1.getX(),planepoup);}}
private void moveRight() {
c1.setFrame(2);
c1.move(3,0);
if(c1.getX()>(getWidth()-c1.getWidth()))
{ c1.setPosition((getWidth()-c1.getWidth())c1.getY());
} }
private void moveLeft() {
c1.move(-3,0);
c1.setFrame(1);
if(c1.getX()<=0)
{
c1.setPosition(0,c1.getY());
}
}
public void start()
{
Thread t=new Thread(this);
t.start();
}
public void commandAction(Command c,Displayable d)
{
if(c.getLabel()=="暂停")
{ conti=false;
removeCommand(c);
addCommand(new Command("继
<< 上一页 [11] [12] [13] [14] [15] [16] [17] 下一页
java手机游戏设计源代码 第15页下载如图片无法显示或论文不完整,请联系qq752018766