资源简介
大鱼吃小鱼游戏源码,包含整个游戏源码和图片、背景音乐资源。
代码片段和文件信息
package src;
import java.io.IOException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public class AllSp {
GameCanvas GC;
Image ImageShuipao ImageShuipao2 ImageMa;
Image ImageHX;
Image life;
int b;
int life_x;
int life_y;
int n=0;
int shuipao_x;
int shuipao_y;
int HX_x;
int HX_y;
int ma_x;
int ma_y;
int MaNumber;
int count = 0;
int chance;
public AllSp(GameCanvas GC) {
this.GC = GC;
init();
}
public void init() {
try {
life = Image.createImage(“/res/picture/life.png“);
ImageShuipao = Image.createImage(“/res/picture/shuipao1.png“);
ImageShuipao2 = Image.createImage(“/res/picture/shuipao2.png“);
ImageMa = Image.createImage(“/res/picture/ma.png“);
ImageHX = Image.createImage(“/res/picture/bounus0.png“);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
b=0;
shuipao_x = 50;
shuipao_y = 320;
ma_x = 500;
ma_y = 250;
HX_x = GameCanvas.getRandom(10 220);
HX_y = GameCanvas.getRandom(-50 -2);
chance = GameCanvas.getRandom(1 4);
life_x = GameCanvas.getRandom(10 220);
life_y = GameCanvas.getRandom(-100 -2);
}
public void drawlife(Graphics g) {
g.drawImage(life life_x life_y Graphics.TOP
| Graphics.LEFT);
}
// 生命图标画笔
//水泡画笔
public void drawShuipao(Graphics g) {
g.drawImage(ImageShuipao shuipao_x shuipao_y Graphics.TOP
| Graphics.LEFT);
}
// 海星画笔
public void drawHX(Graphics g) {
g.drawImage(ImageHX HX_x HX_y Graphics.TOP | Graphics.LEFT);
}
//海马画笔
public void drawMa(Graphics g) {
GameCanvas.Brush(g ImageMa ma_x ma_y 15 21 MaNumber 0);
ma_x -= 2;
if (ma_x < 0) {
ma_x = GameCanvas.getRandom(350 500);
}
count++;
if (count % 2 == 0) {
if (MaNumber < 1) {
MaNumber++;
} else {
MaNumber = 0;
}
}
}
//海星得移动碰撞处理方法
public void HxAction() {
HX_y += 3;
if (HX_y > 1500) {
HX_x = GameCanvas.getRandom(10 220);
HX_y = GameCanvas.getRandom(-50 -2);
}
if (GC.isRam(GC.MainFish_x + 10 GC.MainFish_y + 8 GC.MainFish
.getWidth() / 5 - 20 GC.MainFish.getHeight() / 2 - 15 HX_x
HX_y 13 13)) {
ChanceAction(chance);
// HX_x = GameCanvas.getRandom(10 220);
HX_y = 350;
chance = GameCanvas.getRandom(1 4);
}
}
// 生命得加减处理方法
public void lifeAction(){
life_y+=4;
if(life_y>=2000){
life_x = GameCanvas.getRandom(10 220);
life_y = GameCanvas.getRandom(-2000 -2);
}
if (GC.isRam(GC.MainFish_x + 10 GC.MainFish_y + 8 GC.MainFish
.getWidth() / 5 - 20 GC.MainFish.getHeight() / 2 - 15 life_x
life_y 14 11)){
life_x = GameCanvas.getRandom(10 220);
life_y = GameCanvas.getRandom(-100 -2);
}
}
//海星碰撞随即处理方法
public void ChanceAction(int chance) {
switch (chance) {
case 1:
GC.score = 800;
break;
case 2
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-05-25 10:30 2012\
文件 226 2010-06-22 19:13 2012\.classpath
文件 236 2010-06-22 19:13 2012\.eclipseme
文件 536 2010-06-22 19:13 2012\.project
目录 0 2015-05-25 10:30 2012\.settings\
文件 166 2010-06-28 13:54 2012\.settings\org.eclipse.jdt.core.prefs
文件 220 2010-06-22 19:17 2012\2012.jad
目录 0 2015-05-25 10:30 2012\deployed\
文件 244 2010-06-28 13:55 2012\deployed\2012.jad
文件 64424 2010-06-28 13:54 2012\deployed\2012.jar
文件 72232 2010-06-28 13:54 2012\deployed\2012_ba
文件 62889 2010-06-28 13:54 2012\deployed\2012_ba
文件 7287 2010-06-28 13:54 2012\deployed\pro_map.txt
文件 17 2010-06-28 13:54 2012\deployed\pro_seeds.txt
文件 919 2010-06-28 13:54 2012\deployed\proguard.cfg
目录 0 2010-07-15 12:15 2012\res\
目录 0 2010-07-15 12:15 2012\res\picture\
文件 3249 2010-06-22 19:16 2012\res\picture\back.png
文件 5430 2010-06-22 19:16 2012\res\picture\book.png
文件 397 2010-06-22 19:16 2012\res\picture\bounus0.png
文件 178 2010-06-22 19:16 2012\res\picture\chengzhang.png
文件 144 2010-06-22 19:16 2012\res\picture\fish1closedR.png
文件 144 2010-06-22 19:16 2012\res\picture\fish1closedR1.png
文件 169 2010-06-22 19:16 2012\res\picture\fish2closedR.png
文件 180 2010-06-22 19:16 2012\res\picture\fish3closedR.png
文件 892 2010-06-22 19:16 2012\res\picture\fish4closedR.png
文件 591 2010-06-22 19:16 2012\res\picture\fish5closedR.png
文件 622 2010-06-22 19:16 2012\res\picture\fish6closedR.png
文件 135 2010-06-22 19:16 2012\res\picture\jiantou.png
文件 135 2010-06-22 19:16 2012\res\picture\jiantou1.png
文件 479 2010-06-22 19:16 2012\res\picture\life.png
............此处省略61个文件信息
- 上一篇:装瓶流水线的PLC控制
- 下一篇:CH340USB转串口芯片mac os驱动程序
评论
共有 条评论