资源简介
潜艇大战游戏,源代码。有具体注释,很容易看谁能懂。

代码片段和文件信息
# include
# include “13h.h“
# include
# include
# include “timer.h“
# include
# include
struct stBOMB
{
int x;
int y;
BOOL Used;
};
struct stEXPL
{
int x;
int y;
BYTE Num;
BOOL Used;
};
struct stSHIP
{
int x;
int y;
BOOL Used;
BYTE Dir;
BYTE Type;
};
struct stTORP
{
int x;
int y;
BOOL Used;
};
struct stBOMB bbBomb[21];
struct stSHIP spShip[21];
struct stTORP tpTorp[21];
struct stEXPL elExpl[21];
int BombUsed=0;
int ShipUsed=0;
int TorpUsed=0;
int ExplUsed=0;
int MAXBOMB=5;
int MAXSHIP=3;
int MAXTORP=5;
int MAXEXPL=5;
int ID_Timer[MAXTIMER+1];
int ID_Bomb[21];
int ID_Ship[21];
int ID_Torp[21];
int ID_Expl[21];
BOOL DISP=TRUE;
BOOL CLS=FALSE;
BOOL bPaint=FALSE;
BOOL ALIVE=TRUE;
BOOL SOUND=TRUE;
BOOL Flash=FALSE;
BOOL DONE=FALSE;
BYTE SHIP[2][32][64];
BYTE BOMB[32][32];
BYTE TORP[16][16];
BYTE PAL[256][3];
BYTE STR[80];
BYTE far * PIC_EXPL;
BYTE far * PIC_SHIP;
void far * Back1;
void far * Back2;
int MyX=0;
int MyY=0;
int Life=3;
int Score=25;
int LevelScore=25;
int Level=0;
int Step=0;
/* */
char *Info=“\
\\Welcome to play this game!\
\n\
\n\
\n\
In this gameyou will drive a warship to fight with\n\
the submarines.\n\n\
KEYS:\n\
‘Left‘ and ‘Right‘ keys to move your warship.\n\
‘Space bar‘ or ‘Ctrl‘ key to send bombs.\n\
‘S‘ key is a sound switch.\n\
‘D‘ key is a state switch.\n\n\
\n\
\n\n\
GOOD LUCK!\0“;
/* */
void StepIn()
{
int i;
for (i=0;i<256;i++)
/* */
setpal(iPAL[i][0]*Step/64PAL[i][1]*Step/64PAL[i][2]*Step/64);
Step++;
if (Step>64)
/* */
KillAllTimer();
}
/* */
void StepOut()
{
int i;
for (i=0;i<256;i++)
/* */
setpal(iPAL[i][0]*Step/64PAL[i][1]*Step/64PAL[i][2]*Step/64);
Step--;
/* */
if (Step<1)
KillAllTimer();
}
void OutInfo()
{
if (*Info++)
{
sound(1000);
printf(“%c“*(Info-1));
nosound();
}
else
KillAllTimer();
}
void Logo()
{
FILE *bmp;
int irgbxy;
setmode();
bmp=fopen(“logo.bmp““rb“);
fseek(bmp54SEEK_SET);
for (i=0;i<256;i++)
{
PAL[i][2]=fgetc(bmp)>>2;
PAL[i][1]=fgetc(bmp)>>2;
PAL[i][0]=fgetc(bmp)>>2;
fgetc(bmp);
setpal(i000);
}
for (y=0;y<200;y++)
for (x=0;x<320;x++)
pokeb(0xa000y*320+xfgetc(bmp));
fclose(bmp);
CreateTimer(1StepIn);
while (ScanKey()!=57&&TimerUsed)
TimerEvent();
Step=64;
StepIn();
wait();
CreateTimer(1StepOut);
while (ScanKey()!=57&&TimerUsed) TimerEvent();
Step=0;
StepOut();
closemode();
CreateTimer(2OutInfo);
locate(626);
while (ScanKey()!=57&&TimerUsed)
TimerEvent();
while (*Info++)
printf(“%c“*(Info-1));
wait();
}
void KillSelf()
{
if (SOUND
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-10-12 12:43 08-娼滆墖澶ф垬娓告垙\
文件 2423 2004-05-11 19:35 08-娼滆墖澶ф垬娓告垙\13H.H
文件 5174 2001-12-15 19:09 08-娼滆墖澶ф垬娓告垙\boat.bmp
文件 1540 2001-12-15 19:03 08-娼滆墖澶ф垬娓告垙\bomb.bmp
文件 60726 2001-12-15 19:08 08-娼滆墖澶ф垬娓告垙\expl.bmp
文件 65080 2003-10-29 19:49 08-娼滆墖澶ф垬娓告垙\Logo.bmp
文件 65080 2011-04-13 08:57 08-娼滆墖澶ф垬娓告垙\Logo1.bmp
文件 180054 2003-10-29 19:23 08-娼滆墖澶ф垬娓告垙\ms_submarine.bmp
文件 24537 2003-10-29 19:00 08-娼滆墖澶ф垬娓告垙\ms_submarine.jpg
文件 11158 2001-12-15 19:09 08-娼滆墖澶ф垬娓告垙\SHIP.BMP
文件 13763 2004-05-11 19:17 08-娼滆墖澶ф垬娓告垙\ship.c
文件 43921 2004-05-11 19:36 08-娼滆墖澶ф垬娓告垙\ship.exe
文件 24576 2011-05-05 11:34 08-娼滆墖澶ф垬娓告垙\Thumbs.db
文件 1333 2004-05-11 19:23 08-娼滆墖澶ф垬娓告垙\TIMER.H
文件 772 2001-12-15 19:03 08-娼滆墖澶ф垬娓告垙\torp.bmp
- 上一篇:C和C++写的DBMS数据库
- 下一篇:清华C++课件 PPT
相关资源
- 国际象棋的qt源代码
- C语言开发实战宝典
- 小甲鱼C语言课件 源代码
- c语言看发的网络协议 ,源代码
- C语言实现的DES对称加密算法
- 数据结构,迷宫问题C语言版源代码
- C语言 学生信息管理系统 源代码
- C语言版3D魔方游戏源代码
- QT5开发及源代码
- USB CAN Tool 源代码(LabVIEW 2011环境)
- 超声波水表源代码
- 一个模糊PID温度控制算法源代码
- 数据结构 图的遍历源代码
- 数据结构实验源代码集
- TCP/IP客户端和服务器端源代码,好用
- 交互式计算机图形学 第六版 OpenGL源代
- 数据结构教程李春葆第五版书中例题
- 三次样条插值类源代码!
- diy写字机grbl v1.1源代码
- C语言常用算法源代码
- 关于LED制作的源代码合集(38套)
-
STM32-ba
se64加密源代码 - 51超声波避障源代码
- 一个C++实现的源代码行数统计工具
- ZZULIOJ部分答案C语言免费.7z
- 吉他调音软件源代码
- 连连看源代码C语言版
- AVR单片机SPI通讯程序 (C语言源代码)
- Visual+C++数字图像处理-谢凤英-源代码
- 大富翁源代码
评论
共有 条评论