游戏连载-4
//////////////////////////////////////////////////////////////////DirectXHeader.h/////////////////////////////////////////////////////////////////
#pragma once
#pragma comment(lib,"dinput8.lib")
///////////////////////////////////////////////////////////////// MyEnemy.h/////////////////////////////////////////////////////////////////
#pragma once
#include "MySprite.h"
typedef enum _DIRECTION{
DIR_UP=0,
DIR_DOWN,
DIR_LEFT,
DIR_RIGHT
}DIRECTION;//敌人的方向
class CMyEnemy:public CMySprite
{
public:
CMyEnemy();
CMyEnemy(int level);
CMyEnemy(float x,float y);
~CMyEnemy();
int m_level;//1~8
int m_hp;
void UpdateEnemyPosition();
//直接往下
void DirectDown();
//曲线往下
float movedVelocity;
float m_PrePosX;
void CurveDown();
//向玩家靠近
void MoveToPlayer(CMySprite &player);
};
///////////////////////////////////////////////////////////////// MyBullet.h/////////////////////////////////////////////////////////////////
#pragma once
#include "MySprite.h"
#include "DirectXHeader.h"
class CMyBullet:public CMySprite
{
public:
CMyBullet();
~CMyBullet();
bool Collision( CMySprite &sprite2);// 对象要引用 不然会出错的!!
public:
bool exist;
//如果爆炸
bool collisioned;
bool shouldStartCollisionAnim;
int startCollisionFrame;
int startCollisionTime;
void ResetBulletCollisionState();
//
RECT rect;
void StartCollisionAimation();
};
/////////////////////////////////////////////////////////////////MyDirect3D.h/////////////////////////////////////////////////////////////////
#pragma once
#include <windows.h>
#include "DirectXHeader.h"
extern LPDIRECT3D9 d3d;
extern LPDIRECT3DDEVICE9 d3ddev;
extern LPDIRECT3DSURFACE9 backbuffer;
bool Direct3D_Init(HWND hwnd, int width, int height, bool fullscreen);
void Direct3D_Shutdown();
//
//DirectInput objects, devices, and states
extern LPDIRECTINPUT8 dinput;
extern LPDIRECTINPUTDEVICE8 dikeyboard;
//DirectInput functions
bool DirectInput_Init(HWND);
void DirectInput_Update();
void DirectInput_Shutdown();
bool Key_Down(int);
//
////////////////////////////////////////////////////////////////MyPlayer.h////////////////////////////////////////////////////////////////
#pragma once
#include "MySprite.h"
class CMyPlayer:public CMySprite
{
public:
CMyPlayer();
~CMyPlayer();
};