一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

J2ME小游戏-fly

时间:2022-07-02 17:46:03 编辑:袖梨 来源:一聚教程网

1、FlyMidlet.java
package fly;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
/**
*

Title:


*

Description:


*

Copyright: Copyright (c) 2004


*

Company:


* @author not attributable
* @version 1.0
*/
public class FlyMidlet extends MIDlet {
Navigate ng;
public FlyMidlet() {
ng=Navigate.getInstance(this);
}
protected void startApp() {
System.out.println("startApp");
ng.display.setCurrent(ng.mc);
printInfo();
}
protected void pauseApp() {
System.out.println("pauseApp");
}
protected void destroyApp(boolean parm1) {
System.out.println("destroyApp");
Navigate.mc.stop();
MyGameCanvas.cleanJob();
Navigate.cleanJob();
}
private void printInfo(){
System.out.println("FlyMidlet printInfo() start:");
System.out.println("FlyMidlet printInfo() end:");
}
}
2、Bullets.java
package fly;
import javax.microedition.lcdui.game.*;
import javax.microedition.lcdui.*;
import java.util.Random;
/**
*

Title:


*

Description:


*

Copyright: Copyright (c) 2004


*

Company:


* @author not attributable
* @version 1.0
*/
public class Bullets extends GameObject {
private int[][] bullets;
private int bulletstotal;
private Random rnd;
public static final int BULLET_TYPE_LEFT=0;
public static final int BULLET_TYPE_RIGHT=1;
public static final int BULLET_TYPE_TOP=2;
public static final int BULLET_TYPE_BOTTOM=3;
private int width,height;
public Bullets(Image img,int picwidth,int picheight,int bulletstotal,int width,int height) {

热门栏目