资源简介
策划程序美工全是自己一人完成,用VS2010 和c++写的,同学帮忙测试,画面操作可玩性感觉很不错,哈哈~而且自带地图编辑器哦~~
想回顾经典游戏的朋友,或者新手想学windows游戏开发可以参考源码,注释很详细,代码基本是纯C++加上STL容器和win32 API手工编写的,逻辑不是很复杂,也适合初学者学习GDI图形编程和windows编程入门。。

代码片段和文件信息
#include “baseTank.h“
#include “tank.h“
baseTank::baseTank(
int _id
int _life
int _armor
int _face
int _x
int _y
int _gun_face
bool _gun_lock
int _move
int _speed
int _fire_speed
int _bullet_id
int _bullet_max
int _bullet_power
int _bullet_speed):
id(_id)
life(_life)
armor(_armor)
face(_face)
x(_x)
y(_y)
gun_face(_gun_face)
gun_lock(_gun_lock)
gun_step(0)
move(_move)
move_step(0)
speed(_speed)
speed_real(speed)
fire_step(0)
fire_speed(_fire_speed)
bullet_id(_bullet_id)
bullet_num(0)
bullet_max(_bullet_max)
bullet_power(_bullet_power)
bullet_speed(_bullet_speed)
delay(0)
{
}
baseTank::~baseTank(void)
{
}
void baseTank::Move()
{
if ( face == DOWN ) y+=speed_real;
else if ( face == LEFT ) x-=speed_real;
else if ( face == UP ) y-=speed_real;
else x+=speed_real;
if (++move_step>2) move_step=0;
}
void baseTank::Change(int _face)
{
face=_face;
if(gun_lock==false)gun_face=face;
if (++move_step>2) move_step=0;
}
void baseTank::Fire()
{
if(!gun_step)
{
gun_step=100;
fire_step=3;
}
}
void baseTank::Death()
{
}
void baseTank::Draw(HDC &DC1HDC &DC2bool fire)
{
int gun_x;
int gun_y;
int fire_x;
int fire_y;
int _gun_step;
_gun_step=gun_step/20;
switch(gun_face)
{
case DOWN:
gun_x=x;
gun_y=y-_gun_step*(bullet_power/10);
fire_x=gun_x;
fire_y=gun_y+48;
break;
case LEFT:
gun_x=x+_gun_step*(bullet_power/10);
gun_y=y;
fire_x=gun_x-48;
fire_y=gun_y;
break;
case UP:
gun_x=x;
gun_y=y+_gun_step*(bullet_power/10);
fire_x=gun_x;
fire_y=gun_y-48;
break;
case RIGHT:
gun_x=x-_gun_step*(bullet_power/10);
gun_y=y;
fire_x=gun_x+48;
fire_y=gun_y;
}
if(fire==false)
{
//坦克底盘
BitBlt(DC1xy6464DC2face*64id*1280+move_step*128+64SRCPAINT);
BitBlt(DC1xy6464DC2face*64id*1280+move_step*128SRCAND);
//坦克炮台
BitBlt(DC1gun_xgun_y6464DC2gun_face*64id*1280+(5-_gun_step)*128+128*3+64SRCPAINT);
BitBlt(DC1gun_xgun_y6464DC2gun_face*64id*1280+(5-_gun_step)*128+128*3SRCAND);
}
else
{
//坦克火花
if(fire_step>0)
{
--fire_step;
BitBlt(DC1fire_xfire_y6464DC2gun_face*64id*1280+9*128+64SRCPAINT);
BitBlt(DC1fire_xfire_y6464DC2gun_face*64id*1280+9*128SRCAND);
}
if(gun_step>0)
{
gun_step-=fire_speed;
if(gun_step<0)gun_step=0;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 556856 2010-12-15 10:54 坦克大战源码\background.bmp
文件 3226 2010-12-23 20:32 坦克大战源码\ba
文件 876 2010-12-21 10:08 坦克大战源码\ba
文件 192056 2010-12-21 13:27 坦克大战源码\bullet.bmp
文件 1040 2010-12-18 13:27 坦克大战源码\Bullet.cpp
文件 435 2010-12-17 13:29 坦克大战源码\Bullet.h
文件 16044 2010-12-18 14:55 坦克大战源码\death.wav
文件 69840 2010-12-18 12:50 坦克大战源码\fire.bmp
文件 328 2010-12-18 20:21 坦克大战源码\Fire.cpp
文件 192 2010-12-18 13:37 坦克大战源码\Fire.h
文件 7268 2010-12-17 18:37 坦克大战源码\hit.wav
文件 688184 2010-12-21 19:22 坦克大战源码\map_block.bmp
文件 12242 2010-12-17 18:37 坦克大战源码\motor.wav
文件 7864376 2010-12-21 15:40 坦克大战源码\pla
文件 1976 2010-12-18 14:55 坦克大战源码\resource.h
文件 9518 2010-12-17 18:37 坦克大战源码\shoot.wav
文件 217990 2010-12-15 09:16 坦克大战源码\start.wav
文件 61707 2012-03-20 18:26 坦克大战源码\tank.cpp
文件 2356 2010-12-24 12:55 坦克大战源码\tank.h
文件 115919 2010-12-13 08:42 坦克大战源码\tank.ico
文件 6754 2010-12-18 14:55 坦克大战源码\TANK.rc
文件 4266 2010-12-17 18:37 坦克大战源码\turret.wav
文件 9988096 2012-03-20 18:26 坦克大战.exe
目录 0 2012-03-20 18:30 坦克大战源码
----------- --------- ---------- ----- ----
19821545 24
- 上一篇:算术编码C++ 源代码
- 下一篇:基于ITK、VTK与MFC读取DICOM图像
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 猜数字游戏 c语言代码
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- LINUX下命令行界面的C语言细胞游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 用C语言实现的一个打字游戏
- C语言版3D魔方游戏源代码
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
评论
共有 条评论