资源简介
j2me挖金矿游戏源代码,经典手机游戏。
代码片段和文件信息
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
public class CrookSprite extends Sprite {
public final static int CIRCUMGYRATEING = 11;
public final static int STRETCHING = 12;
public final static int BACKING = 13;
public final static int CATCHING = 14;
public int CrookSpriteState = CIRCUMGYRATEING;
public static final double[] SIN = { Math.sin(75 * Math.PI / 180)
Math.sin(60 * Math.PI / 180) Math.sin(45 * Math.PI / 180)
Math.sin(30 * Math.PI / 180) Math.sin(15 * Math.PI / 180)
Math.sin(0 * Math.PI / 180) Math.sin(-15 * Math.PI / 180)
Math.sin(-30 * Math.PI / 180) Math.sin(-45 * Math.PI / 180)
Math.sin(-60 * Math.PI / 180) Math.sin(-75 * Math.PI / 180) };
public static final double[] COS = { Math.cos(75 * Math.PI / 180)
Math.cos(60 * Math.PI / 180) Math.cos(45 * Math.PI / 180)
Math.cos(30 * Math.PI / 180) Math.cos(15 * Math.PI / 180)
Math.cos(0 * Math.PI / 180) Math.cos(-15 * Math.PI / 180)
Math.cos(-30 * Math.PI / 180) Math.cos(-45 * Math.PI / 180)
Math.cos(-60 * Math.PI / 180) Math.cos(-75 * Math.PI / 180) };
private int nowSpeed;
private int nowValue;
private int direction;
private boolean isRight;
private int lineEndX;
private int lineEndY;
private int linelength;
private int catchOre;
public CrookSprite(Image arg0 int arg1 int arg2) {
super(arg0 arg1 arg2);
}
public void upData(OreSprite[] allOre) {
switch (CrookSpriteState) {
case CIRCUMGYRATEING:
if (isRight) {
direction++;
if (direction >= 10)
isRight = false;
} else {
direction--;
if (direction <= 0)
isRight = true;
}
break;
case STRETCHING:
linelength+=nowSpeed;
checkCollide(allOre);
break;
case BACKING:
if(gameScreen.nowframe==0)
gameScreen.nowframe=1;
else
gameScreen.nowframe=0;
linelength-=nowSpeed;
if(linelength<=16){
this.CrookSpriteState=CIRCUMGYRATEING;
gameScreen.fire=false;
gameScreen.nowframe=1;
}
break;
case CATCHING:
if(gameScreen.nowframe==0)
gameScreen.nowframe=1;
else
gameScreen.nowframe=0;
linelength-=nowSpeed;
allOre[catchOre].setPosition(lineEndX-allOre[catchOre].getWidth()/2 lineEndY);
if(linelength<=16){
this.CrookSpriteState=CIRCUMGYRATEING;
gameScreen.score+=nowValue;
nowValue=0;
gameScreen.fire=false;
gameScreen.nowframe=1;
allOre[catchOre].setVisible(false);
}
break;
default:
break;
}
lineEndX = (int) (110 - linelength * SIN[direction]);
lineEndY = (int) (39 + linelength * COS[direction]);
checkBounds();
if (direction > 5) {
this.setframe(5 - (direction - 5));
this.setTransform(Sprite.TRANS_MIRROR);
this.setPosition(lineEndX - 9 lineEndY - 10);
} else {
this.setframe(direction);
this.setTransform(Sprite.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 238 2009-04-15 23:30 myWaJinKuang\.classpath
文件 247 2009-04-15 23:30 myWaJinKuang\.eclipseme
文件 544 2009-04-15 23:30 myWaJinKuang\.project
文件 1972 2009-04-15 23:30 myWaJinKuang\crook.png
文件 3353 2009-04-16 13:16 myWaJinKuang\CrookSprite.class
文件 3888 2009-04-16 13:16 myWaJinKuang\CrookSprite.java
文件 30089 2009-04-15 23:30 myWaJinKuang\gameback.png
文件 6825 2009-04-16 12:46 myWaJinKuang\gameScreen.class
文件 6641 2009-04-16 12:46 myWaJinKuang\gameScreen.java
文件 4096 2009-04-16 12:31 myWaJinKuang\gameStart.class
文件 2464 2009-04-16 12:31 myWaJinKuang\gameStart.java
文件 814 2009-04-15 23:30 myWaJinKuang\goldlarge.png
文件 601 2009-04-15 23:30 myWaJinKuang\goldmedium.png
文件 410 2009-04-15 23:30 myWaJinKuang\goldsmall.png
文件 885 2009-04-15 23:30 myWaJinKuang\logo.png
文件 1654 2009-04-15 23:30 myWaJinKuang\mandown.png
文件 1676 2009-04-15 23:30 myWaJinKuang\manup.png
文件 203 2009-04-15 23:30 myWaJinKuang\myWaJinKuang.jad
文件 780 2009-04-15 23:30 myWaJinKuang\OreSprite.class
文件 442 2009-04-15 23:30 myWaJinKuang\OreSprite.java
文件 798 2009-04-15 23:30 myWaJinKuang\rocklarge.png
文件 581 2009-04-15 23:30 myWaJinKuang\rockmedium.png
文件 30885 2009-04-15 23:30 myWaJinKuang\scoremenu.png
文件 208 2009-04-15 23:30 myWaJinKuang\.settings\org.eclipse.jdt.core.prefs
文件 1972 2009-04-15 23:30 myWaJinKuang\verified\classes\crook.png
文件 3584 2009-04-16 13:16 myWaJinKuang\verified\classes\CrookSprite.class
文件 30089 2009-04-15 23:30 myWaJinKuang\verified\classes\gameback.png
文件 7051 2009-04-16 12:46 myWaJinKuang\verified\classes\gameScreen.class
文件 4223 2009-04-16 12:31 myWaJinKuang\verified\classes\gameStart.class
文件 814 2009-04-15 23:30 myWaJinKuang\verified\classes\goldlarge.png
............此处省略17个文件信息
- 上一篇:背景差分人体检测
- 下一篇:54、80坐标及3度带6度带换算
评论
共有 条评论