① vb小游戏源代码
Rem 窗体创建三个单选框按钮,Option1、Option2、Option3。
小游戏是一个较模糊的概念,它是相对于体积庞大的单机游戏及网络游戏而言的,泛指所有体积较小、玩法简单的游戏,通常这类游戏以休闲益智类为主,有单机版有网页版,在网页上嵌入的多为FLASH格式。
当下小游戏主要是指在线玩的flash版本游戏,统称小游戏,其实小游戏还包含单机游戏,小型游戏机等。一般游戏大小小于10m的游戏都统称为小游戏,一些街机类小游戏。因其游戏安装简便,耐玩性强,无依赖性而广受白领及小朋友的喜爱。
小游戏”这个词的型含义其实很简单,它不是一些大的游戏,不必花费更多的时间和精力。
小游戏是原始的游戏娱乐方式,小游戏本身是为了叫人们在工作,学习后的一种娱乐、休闲的一种方式,不是为了叫玩家为之花费金钱、花费精力,更不是叫玩家为他痴迷。
小游戏也可以理解为“Flash游戏”,是以SWF为后缀的游戏的总称.这些游戏是通过Flash软件和 Flash 编程语言 Flash ActionScript 制作而成。
由于Flash是矢量软件,所以小游戏放大后几乎不影响画面效果。Flash小游戏是一种新兴起的游戏形式,以游戏简单,操作方便,绿色,无需安装,文件体积小等优点渐渐被广大网友喜爱。
② 娓告垙浠g爜濡备綍銮峰彇
鍦ㄦ父鎴忓紑鍙戦嗗烟涓锛屾父鎴忎唬镰佹槸闱炲父閲嶈佺殑涓閮ㄥ垎銆傛父鎴忎唬镰佹槸娓告垙瀹炵幇镄勬牳蹇冿纴鍖呮嫭娓告垙阃昏緫銆佹父鎴忕晫闱㈠拰娓告垙瑙勫垯绛夈傚洜姝わ纴璁稿氭父鎴忓紑鍙戣呭拰鐜╁堕兘甯屾湜鑳藉熻幏鍙栨父鎴忎唬镰侊纴浠ヤ究杩涜屼慨鏀广佷紭鍖栧拰镓╁𪾢銆傞偅涔堬纴娓告垙浠g爜濡备綍銮峰彇锻锛熸湰鏂囧皢涓哄ぇ瀹朵粙缁嶅嚑绉嶅父瑙佺殑銮峰彇娓告垙浠g爜镄勬柟娉曘
涓銆佸紑婧愭父鎴忎唬镰
寮婧愭父鎴忔槸鎸囨父鎴忓紑鍙戣呭皢娓告垙浠g爜瀹屽叏寮鏀剧粰鍏浼楋纴浠讳綍浜洪兘鍙浠ヤ笅杞姐佷娇鐢ㄣ佷慨鏀瑰拰鍒嗕韩銆傚湪寮婧愭父鎴忎腑锛屾父鎴忎唬镰侀氩父镓樼″湪GitHub绛変唬镰佹墭绠″钩鍙颁笂銆傚紑婧愭父鎴忕殑濂藉勬槸鍙浠ヨ╂洿澶氱殑浜哄弬涓庡埌娓告垙寮鍙戜腑𨱒ワ纴鍏卞悓瀹屽杽娓告垙锛屽苟涓斿彲浠ラ伩鍏岖増𨱒幂籂绾枫
浜屻侀嗗悜宸ョ▼
阃嗗悜宸ョ▼鏄鎸囬氲繃鍙嶆眹缂栥佽皟璇旷瓑镓嬫碉纴灏嗗凡缂栬疟镄勭▼搴忚浆鍖栦负鍙璇荤殑婧愪唬镰併傞氲繃阃嗗悜宸ョ▼鍙浠ヨ幏鍙栨父鎴忕殑婧愪唬镰侊纴浣呜繖绉嶆柟娉曢渶瑕佷竴瀹氱殑鎶链锷熷簳鍜屾椂闂存垚链锛屽苟涓斿彲鑳戒细瀛桦湪娉曞緥椋庨橹銆
涓夈佹父鎴忓紑鍙戣呮彁渚
濡傛灉娓告垙寮鍙戣呮効镒忔彁渚涙父鎴忎唬镰侊纴鍒椤彲浠ョ洿鎺ュ悜寮鍙戣呯储鍙栥备竴浜涚嫭绔嫔紑鍙戣呮垨灏忓洟阒熷彲鑳戒细绉鏋佹彁渚涙父鎴忎唬镰侊纴浠ュ惛寮曟洿澶氱殑鐢ㄦ埛鍜屽紑鍙戣呭弬涓庡埌娓告垙寮鍙戜腑𨱒ャ备絾鏄锛屽ぇ澶氭暟鍟嗕笟娓告垙寮鍙戣呬笉浼氭彁渚涙父鎴忎唬镰侊纴锲犱负杩欐牱鍙鑳戒细娉勯湶娓告垙链哄瘑鎴栬呬镜鐘鐗堟潈绛夐梾棰樸
缁间笂镓杩帮纴銮峰彇娓告垙浠g爜镄勬柟娉曚富瑕佹湁寮婧愭父鎴忎唬镰併侀嗗悜宸ョ▼鍜屾父鎴忓紑鍙戣呮彁渚涚瓑銆备絾鏄锛屽湪銮峰彇娓告垙浠g爜镞讹纴闇瑕佹敞镒忕増𨱒冨拰娉曞緥闂棰桡纴阆垮厤渚电姱浠栦汉镄勬潈鐩娿傚傛灉鎭ㄦ兂瑕佸︿範娓告垙缂栫▼锛屽彲浠ラ夋嫨鍙傝冨紑婧愭父鎴忎唬镰佽繘琛屽︿範锛屾垨钥呭弬锷犳父鎴忓紑鍙戣呯殑锘硅鍜屼氦娴佹椿锷ㄣ
③ 游戏软件怎么查看源代码
源代码是看不成的,因为游戏软件打包好做成app的话,是没法看源码的,虽然存在一些特殊情况下,我们可以推测出exe程序是用什么程序写的。但是多数情况下,我们是无法只根据一个exe程序就判断出来的。
根据exe程序我们是无法直接得到程序的源码的。虽然也有一些用于逆向工程的办法,但那不可能把已经是exe的程序反回到它原始的源码情况。而且这些工具都很难用。你可以用“反编译”搜到很多工具,但是说实话,即便是这方面的专家,要看懂反编译以后的程序也不是一件轻松的事情。
④ 哪个网站有。所有所有游戏的源代码
您好,现在很多网站都可以查询到游戏的源代码。
例如17171、u9、766都是可以进行相关查询的。
源代码(也称源程序)是指未编译的按照一定的程序设计语言规范书写的文本文件,是一系列人类可读的计算机语言指令。
在现代程序语言中,源代码可以是以书籍或者磁带的形式出现,但最为常用的格式是文本文件,这种典型格式的目的是为了编译出计算机程序。
⑤ 谁能给我一个手机游戏的源代码啊
这个地址也有,不过直接给你吧,这样比较好
先给你看看主要的类吧
package Game;
import DreamBubbleMidlet;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.microedition.lci.Graphics;
import javax.microedition.lci.Image;
import javax.microedition.lci.game.GameCanvas;
import javax.microedition.lci.game.LayerManager;
import javax.microedition.lci.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.lci.Image;
import javax.microedition.lci.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
看不明白的可以随时来问我哦,还可以当时传给你撒
⑥ C++做一个小游戏,有源代码的最好,谢谢
#include <iostream>
#include<fstream>
#include <ctime>
#include <cmath>
#include <stdlib.h>
#include<stdio.h> //时间 //文件
#include <string>
#define random(x)(rand()%x)
using namespace std;
void thunder(int Dif,int Row,int Column,char *USer)
{
int r,c,alls[22][22],backstage[22][22]={0};
srand((int)time(0));
for(r=1;r<=Row;r++) // 生成alls(0~1)1是雷
{
for(c=1;c<=Column;c++)
{
if(random(6)<1) {alls[r][c]=1;} else{alls[r][c]=0;};
}
};
for(r=0;r<=Row+1;r++) //生成 backstage(正确答案)
{
for(int c=0;c<=Column+1;c++)
{
if(alls[r][c]==1)
{
(int)backstage[r][c]='*'; //将1变为 * 代表雷
}
else
{
for(int i=r-1;i<=r+1;i++) //将0变为数字 (代表周围雷数)
for(int j=c-1;j<=c+1;j++)
{
if(alls[i][j]!=alls[r][c]&&alls[i][j]==1){backstage[r][c]++;};
}
}; //else 结束
}; // for 结束
}; // for 结束
cout<<"======================*********================================"<<endl;
char surface[22][22]; //生成surface(用户界面)
for(r=0;r<22;r++) //全部为零
for(c=0;c<22;c++)
{
surface[r][c]='0';
}
for(r=1;r<=Row;r++) //中间化 # 形成0包围#的形式 (通过数 #-->(*||数字) 的个数 赢的时候停止循环)
for(c=1;c<=Column;c++)
{
surface[r][c]='#';
}
for(r=1;r<=Row;r++) //输出 surface 界面 便于检查
{
for(c=1;c<=Column;c++) {cout<<" "<<surface[r][c];};
cout<<endl;
};
cout<<"请按格式输入"<<endl
<<"前两个数字为坐标,最后一个数字“1”表示此位置为雷,“0”则表示不是。"<<endl
<<"如:1 3 1 表示一行三列是雷;2 4 0 表示二行四列不是雷"<<endl
<<"提示:当数字周围雷都被扫出时,可再次按要求输入此位置,可得到周围数字。"<<endl;
long i=10000000L; //计算时间开始
clock_t start,finish;
double ration;
start=clock();
while(i--); //计算时间开始
int num=Row*Column; //计算#号个数
while(num!=0) //控制 是否点完所有位置
{
int x,y,judge;
cin>>x>>y>>judge;
if(alls[x][y]!=judge)
{
cout<<"you lose!!!"<<endl;
cout<<"The answer is:"<<endl;
for(r=1;r<=Row;r++) //输了 输出backstage 显示正确答案
{
for(int c=1;c<=Column;c++)
{
cout<<" "<<(char)(backstage[r][c]==42?backstage[r][c]:backstage[r][c]+'0'); //输出backstage
}
cout<<endl;
}
break;
}
else
{
if(alls[x][y]==1) {if(surface[x][y]=='#'){num--;}surface[x][y]='@'; } // 雷 判断正确 显示“@”;数“#”
else
{
if(backstage[x][y]!=0) // 数字 判断正确 显示数字
{
if(surface[x][y]=='#'){num--; surface[x][y]=backstage[x][y]+'0'; } // 数“#”
else
{
int lei_num=0;
for(int i=x-1;i<=x+1;i++) //数 数字周围 雷的个数
for(int j=y-1;j<=y+1;j++)
{
if(surface[i][j]=='@')
lei_num++;
}
if(backstage[x][y]==lei_num) // 看数字周围雷是否全部扫出 提示 显示数字周围
{
for(int i=x-1;i<=x+1;i++)
for(int j=y-1;j<=y+1;j++)
if(surface[i][j]=='#') //数“#”
{
surface[i][j]=backstage[i][j]+'0';
num--;
}
}
}
}
else // 数字为零时 显示零周围的零
{
if(surface[x][y]=='#'){num--;}; //数“#”
surface[x][y]=backstage[x][y]+'0';
for(int i=x-1;i<=x+1;i++) // 显示零周围的数字
for(int j=y-1;j<=y+1;j++)
if(surface[i][j]=='#') // 避免 死循环
{
surface[i][j]=backstage[i][j]+'0';
num--; //数“#”
}
for(int k=0;k<20;k++) //最多20层零 (点出最边上的零)
{
for (int R=1;R<=Row;R++) //检查所有零
for(int C=1;C<=Column;C++) //再次显示零周围的数字
{
if(surface[R][C]=='0')
{
for(int i=R-1;i<=R+1;i++)
for(int j=C-1;j<=C+1;j++)
{
if(surface[i][j]=='#') // 避免 死循环 数“#”
{
surface[i][j]=backstage[i][j]+'0';
num--;
}
}
}
} //匹配for 内
} //匹配 for 外
}//匹配else
}//匹配else
}//匹配els
cout<<endl;
cout<<"======================*********================================"<<endl;
for(r=1;r<=Row;r++) //输出界面(已修改)
{
for(c=1;c<=Column;c++) {cout<<" "<<surface[r][c];};
cout<<endl;
};
} //匹配while
finish=clock(); //计算时间结束
ration=(double)(finish-start)/CLOCKS_PER_SEC; //时间变量
if(num==0) //所有
{
cout<<" You win! Congratulations!! "<<endl;
cout<<" Your time is: "<<ration<<endl;
if(Dif==1) //读取 简单扫雷 的存储文件
{
string Name;
string name[6];
double Time,rang;
double times[6];
int i=0;
ifstream inf("扫雷 简单.txt");
for(i=0;i<5;i++) //文件中信息导入到数组里
{
inf>>Name;inf>>rang>>Time;
name[i]=Name;
times[i]=Time;
}
inf.close();
name[5]=USer; //本轮玩家信息
times[5]=ration;
double t1=0;
string t2;
for(int j=0;j<5;j++) //冒泡排序法
{
for(i=0;i<5-j;i++)
{
if(times[i]>times[i+1])
{
t1=times[i];
times[i]=times[i+1];
times[i+1]=t1;
t2=name[i];
name[i]=name[i+1];
name[i+1]=t2;
}
}
}
ofstream outf("扫雷 简单.txt");
for(i=0;i<5;i++) //将前五名玩家信息存储到文件中
{
cout<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
outf<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
}
outf.close();
}
if(Dif==2) //读取 一般扫雷 的存储文件
{
string Name;
string name[6];
double Time,rang;
double times[6];
int i=0;
ifstream inf("扫雷 一般.txt");
for(i=0;i<5;i++) //文件中信息导入到数组里
{
inf>>Name;inf>>rang>>Time;
name[i]=Name;
times[i]=Time;
}
inf.close();
name[5]=USer; //本轮玩家信息
times[5]=ration;
double t1=0;
string t2;
for(int j=0;j<5;j++) //冒泡排序法
{
for(i=0;i<5-j;i++)
{
if(times[i]>times[i+1])
{
t1=times[i];
times[i]=times[i+1];
times[i+1]=t1;
t2=name[i];
name[i]=name[i+1];
name[i+1]=t2;
}
}
}
ofstream outf("扫雷 一般.txt");
for(i=0;i<5;i++) //将前五名玩家信息存储到文件中 并输出
{
cout<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
outf<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
}
outf.close();
}
if(Dif==3) //读取 困难扫雷 的存储文件
{
string Name;
string name[6];
double Time,rang;
double times[6];
int i=0;
ifstream inf("扫雷 困难.txt");
for(i=0;i<5;i++) //文件中信息导入到数组里
{
inf>>Name;inf>>rang>>Time;
name[i]=Name;
times[i]=Time;
}
inf.close();
name[5]=USer; //本轮玩家信息
times[5]=ration;
double t1=0;
string t2;
for(int j=0;j<5;j++) //冒泡排序法
{
for(i=0;i<5-j;i++)
{
if(times[i]>times[i+1])
{
t1=times[i];
times[i]=times[i+1];
times[i+1]=t1;
t2=name[i];
name[i]=name[i+1];
name[i+1]=t2;
}
}
}
ofstream outf("扫雷 困难.txt");
for(i=0;i<5;i++) //将前五名玩家信息存储到文件中
{
cout<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
outf<<name[i]<<" "<<i+1<<" "<<times[i]<<endl;
}
outf.close();
}
}
}
void scale(int dif,char *User) //选择难度
{
int row,column;
if(dif==1) {row=3;column=3;}
if(dif==2) {row=7;column=7;}
if(dif==3) {row=10;column=10;}
cout<<"The scale is: "<<row<<"*"<<column<<endl;
thunder(dif,row,column,User);
};
int main()
{
int Continue=1;
int difficulty;
char user[10];
cout<<" Welcom to the game! "<<endl
<<" 请输入用户名! "<<endl;
cin>>user;
while(Continue==1)
{
cout<<"=======================*******************======================="<<endl
<<" 请选择难度! "<<endl
<<" 简单——1 "<<endl
<<" 一般——2 "<<endl
<<" 困难——3 "<<endl;
cin>>difficulty;
scale(difficulty,user);
cout<<"继续游戏——1 结束游戏——0"<<endl;
cin>>Continue;
}
return 0;
}
扫雷小游戏,自己编的代码
⑦ 请问网络游戏的源代码是什么
网络游戏源代码就是游戏的基础,在外行人眼里是无数行的英文和数字,其实就是一组程序。
作用当然是开发游戏啦。
手上拥有了源代码就可以制作游戏,当然如果你啥都不改,那功能就和原来的游戏没什么两样。
现在网上你可以搜索一下网络游戏的源代码还是非常多的,但是大多数都是不完整的,也就是说你即便得到了也无法用。
另外只要这款游戏是国产的,你如果一模一样也不行,因为违反版权。
所以就算你拿到了源代码,你也要有完整的美术资源,需要让程序贴图替换上去,达到视觉上不一样的效果。世界背景和故事都要换,所有这些的成本当然不是一般的高。
好吧,即便你搞好了,那接下来你还要运营吧,运营的成本就更高了。