java手机游戏设计源代码 第12页
}
public void setAlive(int i)
{
for (int z=i;z<i+3;z++)
{
bullets[i][3]=0;
}
}
public int rscore()
{
return score;
}
public void clean(int i,Sprite sprite[])
{
for (int z=i;z<i+3;z++)
{
//sprite[z].setPosition(0,-1500);
sprite[z].setVisible(false);
no=1;
}}}
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.util.*;
public class gameScreen extends GameCanvas implements Runnable,CommandListener
{ private Form al;
public LayerManager lm,lm1;
TiledLayer b1;
int height=getHeight();
int bosscolor=0;
int sbosscolor=0;
int sbz=0;
int sbmove=0;
int sfire=0;
int smovebz=0;
int sbpzbz=0;
int slife=0;
int sbo=0;
int drawslife=0;
int lr=0;
int drawadd=0;
int pzbz=0;
int pzbzover=0;
int playlife=-1;
int bosslife=0;
int inputno=0;
int position=0;
int j1b=0;
int jbsz=-1;
int sbsz0=-1;
int sbsz1=-1;
int sbsz2=-1;
int sbsz3=-1;
int planepo;
int planepoup;
int kkk;
int gz=0;
int gzks=0;
int jiangli=0;
int jplaneno;
int cloundno=0;
int right=0;
int left=1;
int boss=0;
int over=0;
int ai=0;
int planert=-1;
int supermen=0;
int overcmd=0;
int bossover=0;
int jpb=-12;
int aipp=0;
int jbz=0;
int cloudposition;
Random aik=new Random();
Random aip=new Random();
Random aicloud=new Random();
int jb[]=new int[5];
int playerno=3;
private mybullets[] huokebullet=new mybullets[9];
privateSpritejbullet0,jbullet1,jbullet2,bossbullet0,bossbullet1,bossbullet2;
private Sprite cloud[]=new Sprite[5];
private MenuScreen ms;
privateSpritec1,sboss,cboss,j0,j1,j2,boss1; private lzhhdm midlet;
int s1=0;int s2=65;int s3=0;int row2;
int row;int planecolor=0;
int planecoco=0;public int by1;
public int y1;
public gameScreen (lzhhdm midlet)
{ super(true);this.midlet=midlet;
addCommand(new Command("暂停",Command.BACK,1));
setCommandListener(this);
lm=new LayerManager();
c1=new Sprite(img("/pic/MyPlaneFrames.png"),24,24);
cboss=newSprite(img("/pic/boss.png"),65,50);jbullet0=newSprite(img("/pic/bullet.png"),6,6);
jbullet1=new Sprite(img("/pic/bullet.png"),6,6);
jbullet2=new Sprite(img("/pic/bullet.png"),6,6);
bossbullet0=new Sprite(img("/pic/bullet.png"),6,6);
bossbullet1=new Sprite(img("/pic/bullet.png"),6,6);
bossbullet2=new Sprite(img("/pic/bullet.png"),6,6);
sboss=new Sprite(img("/pic/smallboss.png"),65,50);
b1=createBackGround(); c1.setPosition(getWidth()/2,row2+getHeight()-25);
System.out.println("ffffffffffff");
planepoup=row2;
planepo=row2+getHeight();
j0=new Sprite(img("/pic/jplane2.png"),24,22);
j1=new Sprite(img("/pic/jplane2.png"),24,22);
j2=new Sprite(img("/pic/jplane2.png"),24,22);
kkk=getHeight()/8;
lm.append(j0);
lm.append(j1);
lm.append(j2);
cboss.setVisible(false);
aipp=aip.nextInt()%3;
if(aipp==0)
{aipp=aip.nextInt()%3;
}lm.append(cboss);
lm.append(bossbullet0);
lm.append(bossbullet1);
lm.append(bossbullet2);
lm.append(jbullet0);
lm.append(jbullet1);
lm.append(jbullet2);
lm.append(sboss);
jb[0]=1;jb[1]=1;jb[2]=1;jb[3]=1;
try{for(int i=0;i<=4;i++){
cloud[i]=new Sprite(img("/pic/cloud1.png"),16,16);
lm.append(cloud[i]);}
}catch(Exception e)
{System.out.println("cloud");}
try{for(int i=0;i<9;i++){ huokebullet[i]=playerbullet("/pic/bullet.png");}}catch(Exception e){}
try{for(int i=0;i<=8;i=i+3)
{huokebullet[i].no=1;//ok
huokebullet[i].score=0;}
}catch(Exception e){System.out.println("ffffffffffffff");}
for(int i=0;i<9;i++){
lm.append(huokebullet[i]);}
lm.append(c1);lm.append(b1);
}
private Image img (String pic)
{ Image img=null;
try{ img=Image.createImage(pic);
}catch(Exception exp)
{System.out.println(exp);
}return img;
}
private mybullets playerbullet(String pic)
{Image img=null;
try{ img=Image.createImage(pic);
}catch(Exception exp)
{System.out.println(exp);
}return new mybullets(img,6,6,21,getWidth(),getHeight());}
public TiledLayer createBackGround()
{Image img=null;
try{ img=Image.createImage("/pic/beijing.png");
}catch(Exception exp)
{System.out.println("layer create image");
}
TiledLayer tiledLayer=new TiledLayer(50,200,img,16,16);
int[] map1[]{ 地图};
for(int i=0;i<map1.length;i++)
{ int column=i%15;
row=(i-column)/15; tiledLayer.setCell(column,row,map1[i]);}
row2=(row+1)*16-getHeight();
y1=-row2;
return tiledLayer;}
boolean conti=true;
int rate=50;
public void run()
{ long st=0;
long et=0;
Graphics g=getGraphics();
int l=1350;
while(conti){
st=System.currentTimeMillis();
input();
if(huokebullet[0].isAlive(0)){
huokebullet[0].no--;
if(huokebullet[0].no>0){ huokebullet[0].newposition(huokebullet,0,3,j0,j1,j2,cboss,img("/pic/explosion.png")); }
if(huokebullet[0].no<=0){
huokebullet[0].setAlive(0); huokebullet[0].clean(0,huokebullet);
}} if(huokebullet[3].isAlive(3))
{huokebullet[3].no--;
if(huokebullet[3].no>0)
{ huokebullet[3].newposition(huokebullet,3,3,j0,j1,j2,cboss,img("/pic/explosion.png")); }
<< 上一页 [11] [12] [13] [14] [15] [16] [17] 下一页
java手机游戏设计源代码 第12页下载如图片无法显示或论文不完整,请联系qq752018766