⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tack.h

📁 Win32项目,类似坦克大战的游戏"忘记喧嚣". 游戏的各系统完整,闪屏,道具.碰撞等等....推荐
💻 H
字号:
// 抽象基类
// 所有坦克的基类 
// 功能: 根据坐标显示坦克位置 发子弹,
#pragma once
#include <windows.h>
#include ".\map.h"
#include ".\bullet.h"
#define SAFE_DELETEDC(p)  { if(p) { ::DeleteDC(p);     (p)=NULL; } }
class Tack
{
public:
	Tack(HDC hdc, HDC mdc, HDC bufdc);
	~Tack(void);
	virtual bool MoveAble(Tack *otherTack) = 0;
	virtual void ShowTack(void) = 0;
	void CreateTack(void);
	void CreateTack(int x, int y);                           // 纯虚函数
	void MoveTack(void);                                     // 操作坦克
	void CreatBullet(int tackX, int tackY,int index, int bulletMode = 0);  // 产生子弹
	void Shoot(void);													 // 发射子弹
	virtual void OperateTack(void) = 0;
	void SetRect(int x, int y);
	bool TackHitMap(int x, int y);								 // 检测每个地图块的碰撞
	bool TackHitTack(Tack *otherTack, int thisnewX, int thisnewY);

	RECT    t_rect;													 // 碰撞区域
	int     t_startX;               // 开始坐标
	int     t_startY;
	int     t_nextX;                // 探索坐标
	int     t_nextY;
	int     t_lockX;                // 当前坐标
	int     t_lockY;
	int     t_veloc;                // 速度
	int     t_grade;                // 等级 吃一个道具五星改变
	int     t_tackMode;             // 坦克型号
	int     t_bulletMode;           // 子弹型号  
	int     t_HP;                   // 血量值
	int     t_life;                 // 生命数
	int		t_index;                // 图0右 1下 2上 3左
	bool    t_live;	                // 存活
	bool    t_show;                 // 显示
	bool    t_ableMove;             // 活动标记 某个方向
	bool    t_stop;                 // 静止 4个方向	
	Bullet  *t_bullet[2];             // 每次产生两个子弹

private:	
	HDC     t_hdc;
	HDC     t_mdc;
	HDC     t_bufdc;		
	Map     *map1;
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -