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

📄 ship.h

📁 基于引擎基础上开发的三维游戏实例“恐怖之战”游戏者可以自爱三维地形上漫游
💻 H
字号:
// Ship.h: interface for the CShip class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SHIP_H__07856EA8_36D5_4778_9F75_6427623C444B__INCLUDED_)
#define AFX_SHIP_H__07856EA8_36D5_4778_9F75_6427623C444B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "GameObj.h"
#include "Bullet.h"

class CShip : public CGameObj  
{
public:
	CShip();
	virtual ~CShip();

	Point3f a;
	bool thrust;
	bool lthrust;
	bool rthrust;

	void Update(int t)
	{ 
		Point3f na;
		a=Point3f(0,0,0);
		if(thrust)
		{
			na=VDir();
			na*=20.0;
			a+=na;
		}
		if(lthrust)
		{
			na=VDir();
			na*=20.0;
			na=RotateZ(na,float(M_PI/2));
			a+=na;
		}
		if(rthrust)
		{
			na=VDir();
			na*=20.0;
			na=RotateZ(na,float(-M_PI/2));
			a+=na;
		}
		v += (t/1000.0f*a);
		CGameObj::Update(t);
	}

	void ThrustOn() 
	{ 
		thrust=true;
	}

	void ThrustOff()
	{
		thrust=false;
	}

	void StartStrafeLeft(){lthrust=true;}
	void StartStrafeRight(){rthrust=true;}
	void StopStrafeLeft(){lthrust=false;}
	void StopStrafeRight(){rthrust=false;}
	void StartLeft(){av=180.0;}
 	void StartRight(){av=-180.0;}
	void StopLeft(){av=0.0;}
	void StopRight(){av=0.0;}
	int Draw();
	int MaxBullet() {return 10;};
	void TerminateBullet(){ActiveBullet--;};
	virtual void Shoot(list<CBullet *> &LB)
	{
		if(ActiveBullet < MaxBullet())
		{
			ActiveBullet++;
			CBullet *bb =new CBullet(p,angle,v+VDir()*30);
			LB.push_back(bb);
		}
	}
	protected:
		int ActiveBullet; 
};

#endif // !defined(AFX_SHIP_H__07856EA8_36D5_4778_9F75_6427623C444B__INCLUDED_)

⌨️ 快捷键说明

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