• 大小: 6.03MB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-03
  • 语言: C/C++
  • 标签:

资源简介

c++做的坦克大战。附有源码。可以供学习者参考,界面很好。里面有很多经典的算法。对于c++的程序设计 ,可以参考参考。。

资源截图

代码片段和文件信息

#include“include_def.h“
#include“declare_extern.h“
#include“declare_function.h“
#include“role.h“


void randomize()
{    
time_t t;
    srand((unsigned) time(&t));
}
int random(int n)
{
return(rand()%n);
}

void nextgame()
{
int ij;
for(i=0;i<5;i++)
if(tk[i]!=NULL)
{
delete tk[i];
tk[i]=NULL;
}
for(i=0;i<10;i++)
if(b[i]!=NULL)
{
delete b[i];
b[i]=NULL;
}
for(i=0;i<30;i++)
for(j=0;j<34;j++)
mapnum[i][j]=0;
gamebegin();
isgamepass=false;
tk[5]->attack_tankenum=0;
tk[5]->bullet_number_=0;
}
void gamepass()
{
KillTimer(hWnd1);
KillTimer(hWnd2);
KillTimer(hWnd3);
KillTimer(hWnd4);
KillTimer(hWnd4);
KillTimer(hWnd5);
isgamepass=true;
toll_gate++;



if(toll_gate==4)
{
TextOut(bufferDC540400“你通关了!“_tcslen(“你通关了!“));
Sleep(2000);
exit(0);
}
TextOut(bufferDC540400“你过关了!“_tcslen(“你过关了!“));
Sleep(1000);
}
void playmusic(const char *musicname)
{
char buf[128];
char *play_music;
MCIERROR mcierror;
play_music=(char*)malloc(strlen(musicname)+6);
strcpy(play_music“play “);
strcat(play_musicmusicname);
mcierror=mciSendString(play_musicbufsizeof(buf)NULL);
free(play_music);
}
void loadbmp()
{
windowDC=GetDC(hWnd);
bufferDC=CreateCompatibleDC(windowDC);
    titleDC=CreateCompatibleDC(windowDC);
menuDC=CreateCompatibleDC(windowDC);
tableDC=CreateCompatibleDC(windowDC);
bullet01DC=CreateCompatibleDC(windowDC);
bullet02DC=CreateCompatibleDC(windowDC);
tanke_explodeDC=CreateCompatibleDC(windowDC);
bullet_explodeDC=CreateCompatibleDC(windowDC);
tileDC=CreateCompatibleDC(windowDC);
tank01DC=CreateCompatibleDC(windowDC);
tank02DC=CreateCompatibleDC(windowDC);
tank03DC=CreateCompatibleDC(windowDC);
tank04DC=CreateCompatibleDC(windowDC);
tank05DC=CreateCompatibleDC(windowDC);
tank06DC=CreateCompatibleDC(windowDC);
tank07DC=CreateCompatibleDC(windowDC);
tank08DC=CreateCompatibleDC(windowDC);

bufferbmp=CreateCompatibleBitmap(windowDCwindowwidthwindowheight);
title=(HBITMAP)LoadImage(NULL“tk_pic\\title.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
menu=(HBITMAP)LoadImage(NULL“tk_pic\\menu.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
table=(HBITMAP)LoadImage(NULL“tk_pic\\table.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
bullet01=(HBITMAP)LoadImage(NULL“tk_pic\\bullet01.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
bullet02=(HBITMAP)LoadImage(NULL“tk_pic\\bullet02.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
tanke_explode=(HBITMAP)LoadImage(NULL“tk_pic\\坦克爆炸.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
bullet_explode=(HBITMAP)LoadImage(NULL“tk_pic\\子弹爆炸.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
tile=(HBITMAP)LoadImage(NULL“tk_pic\\tile.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
tank01=(HBITMAP)LoadImage(NULL“tk_pic\\tank01.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
tank02=(HBITMAP)LoadImage(NULL“tk_pic\\tank02.bmp“IMAGE_BITMAP00LR_LOADFROMFILE);
tank03=(HBITMAP)LoadImage(NULL“tk_pic\

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-11-09 12:49  c++做的坦克大战\
     目录           0  2011-11-09 12:49  c++做的坦克大战\map\
     文件        1738  2008-09-05 21:35  c++做的坦克大战\map\map1.txt
     文件        1738  2008-09-05 22:09  c++做的坦克大战\map\map2.txt
     文件        1738  2008-09-05 21:27  c++做的坦克大战\map\map3.txt
     目录           0  2011-11-09 12:49  c++做的坦克大战\SE\
     文件      162738  2000-05-06 23:31  c++做的坦克大战\SE\tk_al.wav
     文件       43606  2001-10-07 21:47  c++做的坦克大战\SE\tk_expb.wav
     文件        3891  2001-10-07 21:47  c++做的坦克大战\SE\tk_fire.wav
     文件      184414  2006-09-18 21:44  c++做的坦克大战\SE\tk_op.wav
     目录           0  2011-11-09 12:49  c++做的坦克大战\tk_pic\
     文件        6200  2008-08-22 21:57  c++做的坦克大战\tk_pic\bullet01.bmp
     文件        3128  2008-08-21 14:29  c++做的坦克大战\tk_pic\bullet02.bmp
     文件        7736  2008-08-21 14:26  c++做的坦克大战\tk_pic\explode.bmp
     文件       19256  2008-08-21 16:30  c++做的坦克大战\tk_pic\menu.bmp
     文件      921656  2008-09-05 18:28  c++做的坦克大战\tk_pic\table.bmp
     文件       24630  2008-08-21 08:57  c++做的坦克大战\tk_pic\tank01.bmp
     文件       24632  2008-08-22 09:40  c++做的坦克大战\tk_pic\tank02.bmp
     文件       24632  2008-08-22 09:46  c++做的坦克大战\tk_pic\tank03.bmp
     文件       24632  2008-08-22 09:48  c++做的坦克大战\tk_pic\tank04.bmp
     文件       24632  2008-08-22 09:48  c++做的坦克大战\tk_pic\tank05.bmp
     文件       24632  2008-08-22 09:48  c++做的坦克大战\tk_pic\tank06.bmp
     文件       24632  2008-08-22 09:48  c++做的坦克大战\tk_pic\tank07.bmp
     文件       24632  2008-08-22 09:48  c++做的坦克大战\tk_pic\tank08.bmp
     文件       10294  2008-08-21 08:01  c++做的坦克大战\tk_pic\tile.bmp
     文件      921656  2008-08-21 16:29  c++做的坦克大战\tk_pic\title.bmp
     文件       30776  2008-09-05 13:30  c++做的坦克大战\tk_pic\坦克爆炸.bmp
     文件       12344  2008-09-05 13:20  c++做的坦克大战\tk_pic\子弹爆炸.bmp
     文件       38866  2006-09-17 19:01  c++做的坦克大战\tk_pic\无敌.jpg
     文件      581120  2008-09-05 22:10  c++做的坦克大战\win32应用程序7.exe
     文件         241  2008-09-05 22:20  c++做的坦克大战\作者说明.txt
............此处省略71个文件信息

评论

共有 条评论

相关资源