• 大小: 2.53MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-21
  • 语言: 其他
  • 标签: j2me  飞行射击  mtk  

资源简介

压缩包了都有说明,自己写的能在我的手机上nokia6630运行

资源截图

代码片段和文件信息


import java.util.Random;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

//奖励物品类
public class Bonus extends Sprite {

//是否激活初始不激活
private boolean isAlive=false;
//奖励物品种类
public int bonusType;
public final static int ADD_BULLET_BONUS=0;
public final static int SPEED_UP_BONUS=1;
public final static int ADD_LIFE_BONUS=2;
public final static int DISPERSE_BULLET_BOUNS=3;
     public final static int ADD_SCORE=4;
//奖励物品高宽
private int frameWidthframeHeight;
//画布高宽
private int canvasWidthcanvasHeight;
private Image imgBonus;
private Bonus bonus;
private Random random;
//奖励物品随机移动方向
private int direction;
public final static int LEFT_DOWN=0;
public final static int RIGHT_DOWN=2;
public final static int MIDDLE_DOWN=1;

public final static int RIGHT_UP=3;
public final static int UP_UP=4;
public final static int LEFT_UP=5;

//奖励物品碰到屏幕边缘次数
private int reflexNum;

public Bonus(Image image int frameWidth int frameHeightint bonusType) {
super(image frameWidth frameHeight);
// TODO Auto-generated constructor stub
imgBonus=image;
this.bonusType=bonusType;
this.frameWidth = frameWidth;
this.frameHeight = frameHeight;
defineReferencePixel(frameWidth / 2 frameHeight / 2);
random=new Random();
direction = (random.nextInt() & 0x0fffffff) % 3;
reflexNum=0;
}
public void setCanvasSize(int canvasWidth int canvasHeight) {
this.canvasWidth = canvasWidth;
this.canvasHeight = canvasHeight;
}
public void setAlive(int x int y) {
isAlive = true;
setPosition(x y);
}
public void setAlive(boolean isAlive) {
this.isAlive = isAlive;
}
public boolean isAlive() {
return isAlive;
}
public Image getImage(){
return imgBonus;
}
public void tick(){
if (isAlive) {
switch (direction) {
case LEFT_DOWN:
move(-4 4);
break;
case RIGHT_DOWN:
move(4 4);
break;
case MIDDLE_DOWN:
move(0 6);
break;
case RIGHT_UP:
move(4 -4);
break;
case UP_UP:
move(0 -4);
break;
case LEFT_UP:
move(-4 -4);
break;
}
if (getX() <= 0) {
switch (direction) {
case LEFT_DOWN:
direction = RIGHT_DOWN;
break;
case LEFT_UP:
direction = RIGHT_UP;
break;
}
reflexNum++;
}
if (getX() >= canvasWidth-frameWidth) {
switch (direction) {
case RIGHT_DOWN:
direction = LEFT_DOWN;
break;
case RIGHT_UP:
direction = LEFT_UP;
break;
}
reflexNum++;
}
if (getY() <= 0) {
switch (direction) {
case LEFT_UP:
direction = LEFT_DOWN;
break;
case UP_UP:
direction = MIDDLE_DOWN;
break;
case RIGHT_UP:
direction = RIGHT_DOWN;
break;
}
reflexNum++;
}
if (getY() >= canvasHeight-frameHeight) {
switch (direction) {
case LEFT_DOWN:
direction = LEFT_UP;
break;
ca

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        242  2008-06-16 20:20  ShotPlane\.classpath

     文件        244  2008-06-16 20:20  ShotPlane\.eclipseme

     文件        222  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\emulation\ShotPlane.jad

     文件     275369  2008-06-16 20:20  ShotPlane\.eclipseme.tmp\emulation\ShotPlane.jar

     文件        229  2008-06-16 20:19  ShotPlane\.eclipseme.tmp\emulation\shotPlaneGame.jad

     文件      92993  2008-06-16 20:19  ShotPlane\.eclipseme.tmp\emulation\shotPlaneGame.jar

     目录          0  2008-11-20 17:52  ShotPlane\.eclipseme.tmp\emulation

     文件       2969  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\Bonus.class

     文件       3117  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\Boss.class

     文件       6411  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\Bullet.class

     文件       8055  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\EnemyPlane.class

     文件       1338  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\GameMIDlet.class

     文件       1710  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\Plane.class

     文件       3953  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\PlayerPlane.class

     文件      48874  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\ShotPlaneGameCanvas.class

     文件       2096  2008-06-30 22:27  ShotPlane\.eclipseme.tmp\verified\classes\Sound.class

     目录          0  2008-11-20 17:52  ShotPlane\.eclipseme.tmp\verified\classes

     目录          0  2008-11-20 17:52  ShotPlane\.eclipseme.tmp\verified\libs

     目录          0  2008-11-20 17:52  ShotPlane\.eclipseme.tmp\verified

     目录          0  2008-11-20 17:52  ShotPlane\.eclipseme.tmp

     文件      26431  2008-06-16 20:19  ShotPlane\.metadata\.log

     文件      50990  2008-06-16 20:19  ShotPlane\.metadata\.plugins\eclipseme.core\devices.xml

     目录          0  2008-11-20 17:52  ShotPlane\.metadata\.plugins\eclipseme.core

     文件        850  2008-06-16 20:19  ShotPlane\.metadata\.plugins\eclipseme.ui\dialog_settings.xml

     目录          0  2008-11-20 17:52  ShotPlane\.metadata\.plugins\eclipseme.ui

     文件      11702  2008-06-16 20:19  ShotPlane\.metadata\.plugins\org.eclipse.core.resources\.history\1\1102f71b9d0e001d12d1b0d8f56ef088

     文件       2769  2008-06-16 20:19  ShotPlane\.metadata\.plugins\org.eclipse.core.resources\.history\1\f159051c9d0e001d12d1b0d8f56ef088

     目录          0  2008-11-20 17:52  ShotPlane\.metadata\.plugins\org.eclipse.core.resources\.history\1

     文件        277  2008-06-16 20:19  ShotPlane\.metadata\.plugins\org.eclipse.core.resources\.history\14\22f5f9159d0e001d12d1b0d8f56ef088

     目录          0  2008-11-20 17:52  ShotPlane\.metadata\.plugins\org.eclipse.core.resources\.history\14

............此处省略514个文件信息

评论

共有 条评论