• 大小: 22.18MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-27
  • 语言: C/C++
  • 标签: Vv  

资源简介

VC++ 使用vs 2013的win 32项目编写的黄金矿工游戏具体代码,可以直接使用,供下载分享

资源截图

代码片段和文件信息

#include “stdafx.h“
//游戏框架
#include “gamebox.h“
//位图
#include “mybitmap.h“
//基本库
#include “stdio.h“
#include “stdlib.h“
#include “ctype.h“
#include “math.h“
//时钟
#include “myclock.h“
//库
#include “mykey.h“

//道具定义
struct EQUIP
{
int iPrice;
char info[100];
};
struct EQUIP equip[]={
{100“炮:能炸掉抓到的物品。售价100“}
{200“体力:加快拉动物品的速度。 售价200“}
{400“魔法:所有物品升值100。 售价400“}
};


//位图
extern MYBITMAP bmPrebmTopbmEarthbmStart;

extern MYBITMAP bmobject;

extern MYBITMAP bmBomb;

extern MYCATCH bmCatch;

extern MYCLOCK myclock;

extern HDC hdcwindowhdccanvashdcmem;

extern MYBUTTON mybutton;


extern int obj_hit_r[];
//速度 
extern int obj_speed[];
//金钱 
extern int obj_value[];

GAMEBOX::GAMEBOX()
{
InitFont();

//初始状态
iState=GAME_INFO;
iAni=0;

hPen=(HPEN)GetStockobject(NULL_PEN);
hBrush=(HBRUSH)GetStockobject(BLACK_BRUSH);

iMatch=0;

iCatchId=INVALIDID;

//玩家数据
iMoneyNow=0;
iSpeedAdd=0;
iFireNum=0;
iMoneyAdd=0;
}

GAMEBOX::~GAMEBOX()
{
}

void GAMEBOX::Show()
{
int i;
char *temp[]={“你可以购买道具“};

switch(iState)
{
case GAME_INFO:
bmStart.Stretch(PIC000GAMEWIDTHGAMEHEIGHT);
//第一秒 从左至右显示图片
if(iAni<=25)
{
Selectobject(hdccanvashBrush);
Selectobject(hdccanvashPen);
i=25-iAni;
Rectangle(hdccanvasGAMEWIDTH-i*i0GAMEWIDTHGAMEHEIGHT);//按平方公式变化
}
//myclock.Show(hdccanvas);
break;

case GAME_MENU:
bmPre.Stretch(PIC_MENU00GAMEWIDTHGAMEHEIGHT);
//显示开始按钮
mybutton.Show(BT_START);
break;

case GAME_LOAD:
bmStart.Stretch(PIC100GAMEWIDTHGAMEHEIGHT);
//进度条长度 570 - 77 =493
//进度条宽度 410 -375 =35
if(iAni<=48)
{
bmStart.Stretch(PIC27737510*iAni35);
}
else
{
bmStart.Stretch(PIC27737549335);
}
ShowMapInfo();
break;

case GAME_IN:
bmTop.Show(PIC_TOP00);
ShowInfoNow();
bmEarth.Stretch(iMatch080GAMEWIDTHGAMEHEIGHT-80);
bmCatch.Show();
//显示金子
for(i=0;i {
if(arobject[i].id<0)
{
continue;
}
bmobject.ShowNoBack(arobject[i].id
arobject[i].x
arobject[i].y);
}
//显示炮
for(i=0;i {
bmobject.ShowNoBack(OBJ_FIRE400+i*3238);
}
bombani.PlayAni();
break;

case GAME_WIN:
bmPre.Stretch(PIC_WIN00GAMEWIDTHGAMEHEIGHT);
break;

case GAME_FAIL:
bmPre.Stretch(PIC_FAIL00GAMEWIDTHGAMEHEIGHT);
break;

case GAME_PASS:
bmPre.Stretch(PIC_PASS00GAMEWIDTHGAMEHEIGHT);
break;

case GAME_ITEM:
bmPre.Stretch(PIC_ITEM00GAMEWIDTHGAMEHEIGHT);
mybutton.Show(BT_NEXT);
mybutton.Show(BT_ITEM_FIRE);
mybutton.Show(BT_ITEM_POWER);
mybutton.Show(BT_ITEM_MAGIC);
//显示道具说明文字
Selectobject(hdccanvashf[1]);
SetBkColor(hdccanvasGetPixel(hdccanvas6555));
SetTextColor(hdccanvasRGB(202010));
TextOut(hdccanvas6555temp[0]strlen(temp[0]));

i=mybutton.idMouseOver-2;//按钮ID比文字大2
if(i>=0 && i<=2)
{
SetBk

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-06-16 23:31  gold\
     目录           0  2018-10-04 10:23  gold\Bin\
     文件     2060347  2018-10-04 10:22  gold\Bin\gold2.exe
     目录           0  2018-10-04 09:59  gold\Bin\ini\
     文件         330  2009-06-18 16:14  gold\Bin\ini\match.txt
     目录           0  2019-06-17 00:18  gold\gold2\
     目录           0  2019-06-16 21:17  gold\gold2\Backup\
     文件         955  2019-04-21 23:25  gold\gold2\Backup\gold2.sln
     文件       21504  2019-06-12 16:53  gold\gold2\Backup\gold2.v12.suo
     目录           0  2019-04-21 23:25  gold\gold2\Backup1\
     文件         955  2019-04-21 23:23  gold\gold2\Backup1\gold2.sln
     文件       14848  2019-04-21 23:24  gold\gold2\Backup1\gold2.v12.suo
     目录           0  2019-06-16 23:33  gold\gold2\Backup2\
     文件         955  2019-06-16 21:17  gold\gold2\Backup2\gold2.sln
     文件       20480  2019-06-16 22:59  gold\gold2\Backup2\gold2.v12.suo
     目录           0  2019-06-16 23:38  gold\gold2\Backup3\
     文件         955  2019-06-16 23:33  gold\gold2\Backup3\gold2.sln
     文件       19968  2019-06-16 23:33  gold\gold2\Backup3\gold2.v12.suo
     目录           0  2019-06-16 23:39  gold\gold2\Backup4\
     文件         955  2019-06-16 23:38  gold\gold2\Backup4\gold2.sln
     文件       19968  2019-06-16 23:33  gold\gold2\Backup4\gold2.v12.suo
     目录           0  2019-06-17 00:03  gold\gold2\Backup5\
     文件         955  2019-06-16 23:39  gold\gold2\Backup5\gold2.sln
     文件       20480  2019-06-16 23:40  gold\gold2\Backup5\gold2.v12.suo
     目录           0  2019-06-17 00:04  gold\gold2\Backup6\
     文件         955  2019-06-17 00:03  gold\gold2\Backup6\gold2.sln
     文件       21504  2019-06-17 00:04  gold\gold2\Backup6\gold2.v12.suo
     目录           0  2019-06-16 23:33  gold\gold2\Debug\
     文件      148453  2019-06-16 21:17  gold\gold2\Debug\StdAfx.obj
     文件       36880  2019-06-16 21:17  gold\gold2\Debug\gamebox.obj
     文件     2416128  2019-06-16 21:17  gold\gold2\Debug\gold2.exe
............此处省略61个文件信息

评论

共有 条评论