谁能给我一个手机游戏的源代码啊

作者&投稿:镇鲍 (若有异议请与网页底部的电邮联系)
怎样看手机游戏的源代码》???~

首先要有X管理器然后Mobile C(编程),用X打开游戏内部,然后复制出来,再用C打开。这种方式仅限于C语言基础,若想完全弄懂可以上论坛看专帖,谢谢

你好,首先要有X管理器然后Mobile C(编程),用X打开游戏内部,然后复制出来,再用C打开。这种方式仅限于C语言基础,若想完全弄懂可以上论坛看专帖,谢谢
腾讯电脑管家企业平台:http://zhidao.baidu.com/c/guanjia/

这个地址也有,不过直接给你吧,这样比较好
先给你看看主要的类吧

package Game;

import DreamBubbleMidlet;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.lcdui.game.LayerManager;
import javax.microedition.lcdui.game.Sprite;

public class Game extends GameCanvas implements Runnable {

protected DreamBubbleMidlet dreamBubbleMidlet;

protected Graphics g;
protected Image loadingImage;
protected Image pauseImage;
protected Image cursorImage;
protected Image jackStateImage;
protected Image johnStateImage;
protected Image numberImage;

protected Sprite cursor;
protected Sprite number;
protected LayerManager cursorManager;
protected LayerManager numberManager;

protected Hashtable bombTable;
protected Map map;
protected LayerManager gameLayerManager;
protected Role player;
protected Sprite playerGhost;

protected int screenWidth;
protected int screenHeight;
protected int delay = 50;
protected int[][] bornPlace;
protected int chooseIndex;
protected int stageIndex = 1;
protected int gameClock;
protected int loadPercent;

protected boolean isPause;
protected boolean isEnd;
protected boolean isPlaying;
protected boolean isLoading;

protected Thread mainThread;

public Game(DreamBubbleMidlet dreamBubbleMidlet) {
super(false);
this.setFullScreenMode(true);
this.dreamBubbleMidlet = dreamBubbleMidlet;

this.screenWidth = this.getWidth();
this.screenHeight = this.getHeight();

try {
this.loadingImage = Image.createImage("/Game/Loading.png");
this.pauseImage = Image.createImage("/Game/Pause.png");
this.cursorImage = Image.createImage("/Game/Cursor.png");
this.jackStateImage = Image.createImage("/State/JackState.png");
this.johnStateImage = Image.createImage("/State/JohnState.png");
this.numberImage = Image.createImage("/State/Number.png");
} catch (IOException e) {
e.printStackTrace();
}

this.g = this.getGraphics();
}

public void loadStage(int stage) {
this.isEnd = false;
this.isPause = false;
this.isPlaying = false;
this.gameLayerManager = new LayerManager();
this.cursorManager = new LayerManager();
this.numberManager = new LayerManager();
this.bombTable = new Hashtable();
this.cursor = new Sprite(this.cursorImage, 32, 32);
this.number = new Sprite(this.numberImage, 12, 10);
this.loadPercent = 20;
sleep();

loadMap(stage);
this.loadPercent = 40;
sleep();

loadPlayer();
this.loadPercent = 60;
sleep();

this.gameLayerManager.append(map.getBombLayer());
this.gameLayerManager.append(map.getBuildLayer());
this.gameLayerManager.append(map.getToolLayer());
this.gameLayerManager.append(map.getFloorLayer());
this.gameLayerManager.setViewWindow(0, -5, screenWidth,
Global.MAP_HEIGHT + 5);
this.cursorManager.append(cursor);
this.numberManager.append(number);
this.loadPercent = 80;
sleep();

this.loadPercent = 100;
sleep();
isPlaying = true;
}

public void run() {
while (!isEnd) {
long beginTime = System.currentTimeMillis();
this.drawScreen();
long endTime = System.currentTimeMillis();
if (endTime - beginTime < this.delay) {
try {
Thread.sleep(this.delay - (endTime - beginTime));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

public void loadMap(int stage) {
switch (stage) {
case 0:
this.map = new Map(Global.MAP_BLOCK);
this.bornPlace = Global.MAP_BLOCK_BORNPLACE;
break;
case 1:
this.map = new Map(Global.MAP_FACTORY);
this.bornPlace = Global.MAP_FACTORY_BORNPLACE;
break;
case 2:
this.map = new Map(Global.MAP_FOREST);
this.bornPlace = Global.MAP_FOREST_BORNPLACE;
break;
case 3:
this.map = new Map(Global.MAP_PIRATE);
this.bornPlace = Global.MAP_PIRATE_BORNPLACE;
break;
case 4:
this.map = new Map(Global.MAP_FAUBOURG);
this.bornPlace = Global.MAP_FAUBOURG_BORNPLACE;
break;
}
}

public void loadPlayer() {
this.player = SingleGameRole.createSingleGameRole(this, Global.JACK,
this.bornPlace[0][0], this.bornPlace[0][1]);
this.gameLayerManager.append(player);
try {
this.playerGhost = new Sprite(Image.createImage("/Character/Jack.png"),
this.player.width, this.player.height);
this.gameLayerManager.append(playerGhost);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void playerUpdate() {
if(!this.player.isAlive)
this.playerGhost.setVisible(false);
this.playerGhost.setFrame(this.player.getFrame());
this.player.updateRole();
}

public void bombUpdate() {
Enumeration enu = this.bombTable.keys();
while (enu.hasMoreElements()) {
String key = (String) enu.nextElement();
Bomb bomb = (Bomb) (bombTable.get(key));

if (bomb.isvisable) {
bomb.update();
} else {
bombTable.remove(key);
bomb = null;
}
}
}

public void mapUpdate() {
this.map.update();
}

public void drawScreen() {
if (gameClock < 10000)
gameClock++;
else
gameClock = 0;
if (!this.isLoading) {
if (!isPause) {
this.operate();
this.bombUpdate();
this.playerUpdate();
this.mapUpdate();
g.setColor(0x000000);
g.fillRect(0, 0, getWidth(), getHeight());
this.drawState();
gameLayerManager.paint(g, 0, this.screenHeight
- Global.MAP_HEIGHT - 5);
} else {
this.drawPauseFrame();
}
} else {
this.drawLoadingFrame();
}
this.flushGraphics();
}

public void drawFailScreen() {

}

public void drawState() {
if (this.player.type == Global.JACK) {
g.drawImage(jackStateImage, 60, 5, Graphics.TOP | Graphics.LEFT);
}
if (this.player.type == Global.JOHN) {
g.drawImage(johnStateImage, 60, 5, Graphics.TOP | Graphics.LEFT);
}

this.number.setFrame(this.player.bombNums);
this.numberManager.paint(g, 101, 15);
this.number.setFrame(this.player.speed);
this.numberManager.paint(g, 133, 15);
this.number.setFrame(this.player.power);
this.numberManager.paint(g, 165, 15);
}

protected void drawPauseFrame() {
g.setColor(0x000000);
g.fillRect(0, 0, getWidth(), getHeight());
this.drawState();
if (gameClock % 5 == 0)
this.cursor.setFrame((this.cursor.getFrame() + 1) % 4);
this.gameLayerManager.paint(g, 0, this.screenHeight - Global.MAP_HEIGHT
- 5);
this.cursorManager.paint(g, screenWidth / 2 - pauseImage.getWidth() / 2
- 32, screenHeight / 2 - pauseImage.getHeight() / 2
+ this.chooseIndex * 33 + 24);
g.drawImage(pauseImage, screenWidth / 2, screenHeight / 2,
Graphics.HCENTER | Graphics.VCENTER);
}

protected void drawLoadingFrame() {
g.setColor(66, 70, 246);
g.fillRect(0, 0, screenWidth, screenHeight);

g.drawImage(loadingImage, screenWidth / 2, 2 * screenHeight / 5,
Graphics.HCENTER | Graphics.VCENTER);

g.setColor(0, 255, 0);
g.fillRect((screenWidth - 120) / 2, 2 * screenHeight / 3,
(this.loadPercent * 120) / 100, 10);

g.setColor(255, 0, 0);
g.drawRect((screenWidth - 120) / 2, 2 * screenHeight / 3, 120, 10);
}

public void showMe() {
new Loading(this.stageIndex);
if (this.mainThread == null) {
mainThread = new Thread(this);
mainThread.start();
}
this.dreamBubbleMidlet.show(this);
}

public void operate() {
int keyStates = getKeyStates();
this.playerGhost.setPosition(this.player.xCoodinate, this.player.yCoodinate);
if ((keyStates & DOWN_PRESSED) != 0) {
this.player.walk(Global.SOUTH);
} else {
if ((keyStates & UP_PRESSED) != 0) {
this.player.walk(Global.NORTH);
} else {
if ((keyStates & RIGHT_PRESSED) != 0) {
this.player.walk(Global.EAST);
} else {
if ((keyStates & LEFT_PRESSED) != 0) {
this.player.walk(Global.WEST);
}
}
}
}
}

protected void keyPressed(int key) {
if (!this.isPlaying)
return;
if (!this.isPause && key == -7) {// 右键
this.chooseIndex = 0;
this.pauseGame();
return;
}
if (key == 35) {// #键
this.nextStage();
return;
}
if (key == 42) {// *键
this.preStage();
return;
}
if (this.isPause) {
switch (key) {
case -1:
case -3:
if (this.chooseIndex == 0)
this.chooseIndex = 2;
else
this.chooseIndex = (this.chooseIndex - 1) % 3;
break;
case -2:
case -4:
this.chooseIndex = (this.chooseIndex + 1) % 3;
break;
case -5:// 确认键
case -6:// 左软键
switch (chooseIndex) {
case 0:
this.continueGame();
break;
case 1:
this.restart();
break;
case 2:
this.endGame();
break;
}
break;
default:
break;
}
} else {
switch (key) {
case 53:
case -5:// 确认键
this.player.setBomb(this.player.getRow(), this.player.getCol());
break;
}
}
}

public void restart() {
new Loading(this.stageIndex);
}

public void continueGame() {
this.isPause = false;
this.player.play();
}

public void pauseGame() {
this.isPause = true;
this.player.stop();
}

public void endGame() {
this.isEnd = true;
this.mainThread = null;
System.gc();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.dreamBubbleMidlet.menu.showMe();
}

public void nextStage() {
if (this.stageIndex < 4) {
this.stageIndex++;
}
new Loading(this.stageIndex);
}

public void preStage() {
if (this.stageIndex > 0) {
this.stageIndex--;
}
new Loading(this.stageIndex);
}

class Loading implements Runnable {
private Thread innerThread;
private int stageIndex;

public Loading(int stageIndex) {
this.stageIndex = stageIndex;
innerThread = new Thread(this);
innerThread.start();
}

public void run() {
isLoading = true;
loadPercent = 0;
System.gc();
loadStage(stageIndex);
isLoading = false;
}
}

public void sleep() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

这个是游戏主体类

下面是游戏的人物类

package Game;

import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

public abstract class Role extends Sprite {

/**
* 人物的基本属性
*/
protected int type;
protected int xCoodinate;
protected int yCoodinate;
protected int row;
protected int col;
protected int width;
protected int height;
protected int speed;
protected int status;
protected boolean isCanOperate = false;
protected boolean isAlive = true;

/**
* 人物放置炸弹的基本属性
*/
protected int power;
protected int bombNums;

protected int characterClock = 0;
protected int deadTime = 0;

protected Game game;

protected Role(Image image, int width, int Height, Game game) {
super(image, width, Height);
this.game = game;
}

/**
* 人物拾起道具
* @param tool
*/
public abstract void pickupTool(int tool);
/**
* 碰撞检测以及坐标的改变,如果对行走条件有特殊需求,既可以在这里写自己的条件
* @param direction
*/
public abstract void collisionCheck(int direction);

public void updateRole() {
if (this.characterClock < 10000) {
this.characterClock++;
} else {
this.characterClock = 100;
}

int row = this.getRow();
int col = this.getCol();

if (this.isAlive) {

int tool = this.game.map.getToolLayer().getCell(col, row);

if (tool > 0) {
this.pickupTool(tool);
this.game.map.getToolLayer().setCell(col, row, 0);
}

if (this.game.map.hasFeature(row, col, Global.DEADLY)) {
this.isAlive = false;
return;
}

if (this.status == Global.BORN
&& this.characterClock > Global.BORN_TIME) {
this.status = Global.SOUTH;
this.setFrame(Global.SOUTH * 6);
this.isCanOperate = true;
}

if (this.status == Global.BORN) {
if (this.characterClock % 2 == 0)
this.setFrame(Global.BORN * 6 + (this.getFrame() - 1) % 4);
return;
}

} else {
this.isCanOperate = false;
if (this.deadTime <= 20) {
this.deadTime++;
} else {
this.deadTime = 100;
this.setVisible(false);
return;
}

if (this.characterClock % 2 == 0) {
if (this.getFrame() < Global.DEAD * 6) {
this.setFrame(Global.DEAD * 6);
} else {
if (this.getFrame() < 29) {
this.setFrame(this.getFrame() + 1);
} else {
if (this.characterClock % 4 == 0) {
this.setFrame(29);
this.setVisible(true);
} else {
this.setVisible(false);
}
}
}
}
}
}

public void walk(int direction) {
if (!isAlive)
return;
if (!isCanOperate)
return;
if(direction==9) return;
this.collisionCheck(direction);

if (this.characterClock % 2 == 0) {
if (this.status == direction) {
this.setFrame(this.status * 6 + (this.getFrame() + 1) % 6);
} else {
this.status = direction;
this.setFrame(this.status * 6);
}
}
this.setPosition(xCoodinate, yCoodinate);
}

public void stop() {
this.isCanOperate = false;
}

public void play() {
this.isCanOperate = true;
}

public abstract void setBomb(int row, int col);

public void increaseBomb() {
if (this.bombNums < Global.MAX_BOMB_NUMBER)
this.bombNums++;
}

public int getRow() {
return getRow(getBottomY(yCoodinate) - Global.MAP_CELL / 2);
}

public int getCol() {
return getCol(xCoodinate + Global.MAP_CELL / 2);
}

protected int getBottomY(int y) {
return y + this.height - 1;
}

protected int getRightX(int x) {
return x + Global.MAP_CELL - 1;
}

protected int getPreY(int y) {
return getBottomY(y) + 1 - Global.MAP_CELL;
}

protected int getRow(int x) {
return x / Global.MAP_CELL;
}

protected int getCol(int y) {
return y / Global.MAP_CELL;
}
}

我的QQ是609419340

看不明白的可以随时来问我哦,还可以当时传给你撒

我个人比较喜欢逛论坛,前段时间,我找到一个还不错的论坛,只要成为它的会员,都可以免费下载它的源码噢。有游戏的、商城、网站等等,比自己辛苦敲代码舒服多了。有需要的话可以去看看,只要充值150元就可以成为会员,论坛每天更新源码,超级多的干货,不错。网页链接



先给分!!马上发你!!


推荐一个绝对免费的手机游戏
给你提供一个免费手机游戏下载的网站:http:\/\/www.51sjyx.com\/ 51手机游戏网 推荐几款我认为不错的免费手机游戏:聊斋之七情六欲破解版(RPG)http:\/\/www.51sjyx.com\/3.html 彩虹城堡之七彩宝石篇(RPG)http:\/\/www.51sjyx.com\/1.html 真三国无双之赵云传破解版(动作)http:\/\/www.51sjyx.com...

手机游戏,死亡游戏之密室逃脱,请给我一份详细的攻略,谢谢你,非常感谢...
我的 手机游戏,死亡游戏之密室逃脱,请给我一份详细的攻略,谢谢你,非常感谢!  我来答 提示该问答中所提及的号码未经验证,请注意甄别。3个回答 #活动# 百度知道那些年,你见过的“奇妙”问答?匿名用户 2013-10-18 展开全部 密室逃脱之全部房间攻略 深红色房间攻略: 1、黄色桌子上的碟子里拿到[戒指]1号...

求一个游戏,手机的 以前玩的z开头的 一开始是个木棍击杀僵尸 途中有小...
僵尸特工队

一个手机游戏,就是4个胖子可以互相撞的,碰到闪光处坚持就能得分,有很 ...
您好,您说的这款游戏叫做【歌剧之王】您可以在腾讯电脑管家——应用宝中进行下载 打开应用宝后,选择下载中心 输入【歌剧之王】下载安装到您的手机中即可 应用宝中的所有应用均经过官网验证,安全无毒可靠,您可以放心下载 希望可以帮到您,望采纳 腾讯电脑管家企业平台:http:\/\/zhidao.baidu.com\/c\/...

谁能告诉我有个手机游戏诺基亚的里面有三个职业分别是战士、盗贼、猎人...
龙与地下城

我记得有一个游戏,就是警车追一些车,的手机游戏。是什么名
您好,您说的这款游戏可能是【极品飞车17——最高通缉】或者【孤胆车神:维加斯】都符合您的描述 这两款游戏您都可以在腾讯电脑管家应用宝中下载 这两款游戏对手机配置要求较高,需要下载数据包,比较大 希望可以帮到您,望采纳 腾讯电脑管家企业平台:http:\/\/zhidao.baidu.com\/c\/guanjia\/ ...

原来摩托罗拉手机上有一个类似于打砖块的游戏.谁知道叫什么
游戏应该是:上面有排列成不同阵型的砖块,下面有一个可以活动的木条,把上面的小球抛出去,然后小球撞击到的砖块都会消失,每次都要用下面的可活动木条接住小球,再弹上去。直到所有砖块被击碎,则成功。这款游戏当初就叫打砖块,应该类似于下图。现在已经经过很多改版了,之前的那款游戏已经搜索不到了,...

求一个比较老的手机游戏。当时是用诺基亚x3玩的,关于养龙的角色扮演游戏...
我感觉你说的跟驯龙高手挺像的 如果不是的话还是去应用宝找找看吧 可能时间比较长了这款游戏不是很好找 但是肯定有很多类似的游戏喔 通过应用宝的游戏分类进行筛选 选择角色类的找自己喜欢的下载 希望能帮助到你

求一个手机游戏名称,消除后让水流能通过,水流到最后,一颗树,水能浇灌到...
您好:我没有找到您描述的这款游戏,不过您可以玩一下天天酷跑、侠盗飞车、极品飞车、节奏大师等游戏,您可以到腾讯电脑管家的安卓游戏里面下载到这些游戏,打开腾讯电脑管家中的软件管理后打开安卓游戏,然后在安卓游戏里面输入游戏名称并搜索,例如天天酷跑,然后就可以看到天天酷跑的下载资源了,将您的手机...

...天黑请闭眼等等小游戏。谁是卧底只用一个手机就能玩的,叫什么名字...
叫聚会玩 。相关介绍:聚会玩是一款专注于聚会游戏的应用,包含了多款轻松简单的聚会游戏,如杀手游戏,谁是卧底、一愚惊人等。聚会玩希望人们能够回归聚会的本质,帮助人们解决聚会不知道玩什么的问题,鼓励人们更多地交流互动,真正享受聚会的乐趣。

美姑县18891012248: 谁能给提供一个手机游戏完整的程序,包括代码,并且能直接在手机上运行,谢谢了.. -
闳尝奇洛: 我有本书《J2ME手机程序Eclipse开发基础》(1CD)(介绍了经典的贪吃蛇,有兴趣的话可以转让给你,赛车等游戏的开发,有源代码和程序),不过需要java程序基础的,俄罗斯方块,有源代码你也用不了啊,开发环境不一样的老大,华容道

美姑县18891012248: 求一个安卓开发小游戏源代码,临时交作业用 -
闳尝奇洛: package com.fiveChess;import android.app.Activity;import android.os.Bundle;import android.view.Display;import android.view.Menu;import android.view.MenuItem;imp...

美姑县18891012248: 求手机游戏制作方法?还有手机游戏代码?
闳尝奇洛: 支持java的手机里有个虚拟机在不断运行,每次它都会搜索它的目录下是否有一种叫做Midlet的类,如果有,并且用户选择了它就运行它.于是java游戏就运行了. 所以,如果我们写一个游戏,就必须让我们的游戏类继承自Midlet类,而Midlet类...

美姑县18891012248: 安卓手机游戏中的代码如何获得? -
闳尝奇洛: 既然你安装了eclipse那你就可以配置sdk环境,然后建一个android project,把你的源代码放进去,选择在你自己的手机上运行就会自动安装到你手机上了.嫌麻烦的话可以发给我,我帮你运行一下直接给你app文件

美姑县18891012248: 手机游戏源代码 -
闳尝奇洛: 上WAP网搜索下载吧. 应该是把游戏下载后,再查看其代码. 上WAP手机网下载:先网上搜索了解一下自己的手机支持的格式.找手机支持的格式再下载. 可直接用手机上WAP网下载(要开通GPRS),也可用电脑上WAP网下好后传至手机...

美姑县18891012248: 我想要我的世界暮色森林的源代码,因为我是手机版,所以我想改改代码,自己在手机里玩,还可以发给朋友玩 -
闳尝奇洛: 你想要我的世界暮色森林的源代码,这个要用专门的软件工具才可以.一般游戏的源代码是不会公布出来的,我的世界暮色森林这款游戏的开发公司你可以去这家公司官方网站去查查看,一般都是电脑版本,你想要在手机上面玩是需要改程序的,一般电脑版本都是有客户端的,需要自己手动下载才能够玩这款游戏,游戏公司也是靠下载流量谋利的,如果你想改源代码估计是不太可能,手机版本和电脑版本不一样,你自己修改一下有可能出现乱码,那样游戏就打不开了,自己慢慢试一试吧,反正我是不会的.

美姑县18891012248: 用J2ME做的手机游戏的源代码(简单点的)
闳尝奇洛: 桌球游戏: import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class MoveMidlet extends MIDlet { private MoveCanvas moveCanvas; public void startApp() { moveCanvas=new MoveCanvas(); Display.getDisplay(this)....

美姑县18891012248: ■用vb编一个简单的游戏(代码)(要详细) -
闳尝奇洛: '猜数字,这个简单了吧. Private Sub Form_Load()Randomizenum = Int(Rnd * 1000)str1 = "输入一个0到999间的整数"Donum1 = Val(InputBox(str1))If num1 > num Thenstr1 = "大了"ElseIf num1 < num Thenstr1 = "小了"ElseMsgBox "恭喜您!答对了."Exit DoEnd IfLoop End Sub

美姑县18891012248: 求基于安卓的斗地主手机游戏的完整代码啊,谢谢啊!! -
闳尝奇洛: 来,给你找到一个:http://download.csdn.net/detail/cq361106306/4521729,csdn上无需积分就可以下载的,朋友是不是做毕业设计用的啊?更多精彩游戏,尽在当乐网(android.d.cn)

美姑县18891012248: 游戏源代码 -
闳尝奇洛: 以下是转贴的1.黑白棋: 游戏规则:自己的3个子连成一线就胜利了.可选择对手:电脑或者游戏者. 添加代码:2.生存游戏: 游戏规则:不能让红色方块碰到小白点.空间会越来越小,需要反应敏捷动作灵敏. 添加代码:3.乒乓球: 游戏规则:用球拍挡球,不要让小球掉下去就好啦. 添加代码:4.空间大战: 游戏规则:按住鼠标发射子弹射击敌方小飞机,同时要注意躲开敌方子弹.敌方全灭就可以进入下一关.有最高分前10名的排行榜. 添加代码:

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网