这是我的第一款手机游戏,虽然实现的功能很简单,但是里面几乎用到了j2me制作游戏的全部知识点,在制作的过程中我也碰到许多的问题,要知道没有什么比那种决定把一件事情做好但是却不知道怎么做更痛苦的事情了,真的会抓狂的^_^但是我的性格告诉我做事rivate Main m;
private boolean over=true;
private Command c=new Command(Exit, , 1);
public Game() {
super(true);
try {
// Set up this canvas to listen to command events
setCommandListener(this);
// Add the Exit command
addCommand(new Command(, , 1));
poly=(/);
background=(/);
init();
} catch(Exception e) {
();
}
}
public void init()throws IOException{
//=new Back();
/*************栏杆**************************/
spoly=new Sprite(poly);
pX=()/2;
pY=4*()/5;
(pX, pY);
(true);
/*************背景************************/
sback=new Sprite(background);
(true);
/****************小球******************/
back=new Back();
= ();
(()/2,()/2);
();
/**************************************/
=new LayerManager();
(s_ball);
(spoly);
(sback);
/****************方块******************/
for(int i=0;i20;i++){
for(int j=0;j10;j++){
rm[i][j]=new RectMany();
rm[i][j].setPoint(add1(i), add1(j));
}
}
}
public int add1(int x){
return
x*=12;
}
public int add(int x){
return
x+=6;
}
// public void
/**
* paint
*/
public void paint(Graphics g) {
(0x11ffff);
for(int i=0;i20;i++){
for(int j=0;j10;j++){
if(rm[i][j].Alive()){
rm[i][j].huafang(g);
}
}
}
if(!over)
(**************Game over*************** );
}
public void motion(){
if(()+()getWidth()()0){
addX=-addX;
}
if(()+()getHeight()()0){
addY=-addY;
}
(addX, addY);
();
}
/***************拦杆控制**********
手机游戏乒乓 来自淘豆网m.daumloan.com转载请标明出处.