3D场景漫游


用DirectX技术,实验三维场景的漫游。包括左右上下的移动,左右上下的旋转,使场景更加真实。提高了可玩性
资源截图
代码片段和文件信息
#include “Boss.h“

int CBoss::iPath[][2]={0330-300-3};

CBoss::CBoss(int sxint syint fwint fhLPCTSTR lpStrImgPath)
:CSprite(sxsyfwfhlpStrImgPath)
{
    m_pathId=0;
m_fireNums=0;
m_imgId=0;
m_iHp=300000;
    m_iMaxHp=m_iHp;
m_type=MO_TYPE_BOSS;
m_status=MO_STATE_MOVING;
m_pBulletImg[0]=new CGameImage(“Image\onebullet.bmp“88);
m_pBulletImg[1]=new CGameImage(“Image\planebullet1.bmp“421);
m_pBulletImg[2]=new CGameImage(“Image\planebullet.bmp“521);
for(int i=0;i {
m_pBullet[i]=new CBullet(10-5088“Image\onebullet.bmp“);
}
}

CBoss::~CBoss(void)
{
}
void CBoss::Upateframe()
{   
static int ti=20;
switch(m_status)
{
case MO_STATE_DEAD:
 if(m_curY>m_fH)
 {
 m_pathId=3;
 Move(iPath[m_pathId][0]iPath[m_pathId][1]);
 }
 break;
case MO_STATE_MOVING:
if(m_curY>0)
{   
if(m_count%ti==0)
{   srand(time(NULL));
ti=rand()%80+20;
m_pathId=(m_pathId+1)%4;
m_imgId=rand()%3;
m_fireNums=rand()%6+5;
if(GetPlayerStatus()!=MO_STATE_DEAD)
for(int i=0;i {
Fire();
}
m_count=0;
}
}
if(m_curY<0)
m_pathId=0;
if(m_curX<0)
m_pathId=1;
if(m_curX>(m_winWidth-m_fW))
m_pathId=2;
if(m_curY>m_winHeight/4)
m_pathId=3;

m_count++;
Move(iPath[m_pathId][0]iPath[m_pathId][1]);
break;

}
for(int i=0;i {
m_pBullet[i]->Updateframe();
}
}
void CBoss::Move(int x/* =0 */int y/* =0 */)
{
      m_curX+=x;
  m_curY+=y;
}
void CBoss::Draw(HDC hBufDC)
{
switch(m_status)
{
case MO_STATE_MOVING:
CSprite::Draw(hBufDC);
break;
}
for(int i=0;i {
m_pBullet[i]->Draw(hBufDC);
}
}
int  CBoss::GetBulletId()
{
for(int i=0;i {
if(m_pBullet[i]->GetStatus()==MO_STATE_DEFAULT)
{
 return i;

}
}
return -1;
}
void CBoss::Fire()
{
int n=GetBulletId();
if(n!=-1)
{
int dx=rand()%3-1;
int dy=iPath[m_pathId][1]+rand()%2;
 

m_pBullet[n]->Send(m_curX+m_fW/2m_curY+m_fHdxabs(dy));
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2121  2008-12-27 11:11  WinGameBoss.cpp

     文件        660  2008-12-26 15:51  WinGameBoss.h

     文件       1345  2008-12-25 13:18  WinGameBullet.cpp

     文件        521  2008-12-25 10:42  WinGameBullet.h

     文件      19968  2008-12-27 10:03  WinGameDebugBoss.obj

     文件       4544  2008-12-27 10:48  WinGameDebugBuildLog.htm

     文件      15223  2008-12-27 09:15  WinGameDebugBullet.obj

     文件      48354  2008-12-27 10:48  WinGameDebugGame.obj

     文件      21245  2008-12-27 09:30  WinGameDebugGameApp.obj

     文件      11653  2008-12-27 09:15  WinGameDebugGameImage.obj

     文件      21637  2008-12-27 09:15  WinGameDebugGameMenu.obj

     文件      24615  2008-12-27 09:46  WinGameDebugNpc.obj

     文件      36803  2008-12-27 10:39  WinGameDebugPlayer.obj

     文件      13751  2008-12-27 09:15  WinGameDebugScene.obj

     文件      19885  2008-12-27 09:15  WinGameDebugSprite.obj

     文件     379904  2008-12-27 10:48  WinGameDebugvc70.idb

     文件     102400  2008-12-27 10:48  WinGameDebugvc70.pdb

     文件     192512  2008-12-27 10:48  WinGameDebugWinGame.exe

     文件     784588  2008-12-27 10:48  WinGameDebugWinGame.ilk

     文件     773120  2008-12-27 10:48  WinGameDebugWinGame.pdb

     文件      10027  2009-01-09 09:49  WinGameGame.cpp

     文件       1222  2008-12-25 17:18  WinGameGame.h

     文件       4518  2008-12-27 09:30  WinGameGameApp.cpp

     文件        536  2008-12-25 10:20  WinGameGameImage.cpp

     文件        292  2008-12-25 10:19  WinGameGameImage.h

     文件       3897  2008-12-22 16:07  WinGameGameMenu.cpp

     文件       1081  2008-12-17 10:49  WinGameGameMenu.h

     文件     375416  2008-12-16 15:26  WinGameImageg.bmp

     文件     409976  2008-12-27 13:48  WinGameImagegs.bmp

     文件      11478  2008-12-22 14:38  WinGameImageBlast.bmp

............此处省略50个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)