made payload shoot forward by using onFire function of CPayload class.
// in payload classvoid OnFire(const D3DXVECTOR3& pos, const D3DXVECTOR3& dir){m_Alive = true;m_Pos = pos;D3DXVec3Normalize(&m_Dir, &dir);}
// in gameFramework class (main class)if (m_Input->IsPressed(DIK_W)) // shoot to upm_PlayerPM->OnFire(m_Player->getPosition(), D3DXVECTOR3(0.f, -1.f, 0.f));if (m_Input->IsPressed(DIK_D)) // shoot to rightm_PlayerPM->OnFire(m_Player->getPosition(), D3DXVECTOR3(1.f, 0.f, 0.f));if (m_Input->IsPressed(DIK_A)) // shoot to leftm_PlayerPM->OnFire(m_Player->getPosition(), D3DXVECTOR3(-1.f, 0.f, 0.f));
made payload shoot forward by using onFire function of CPayload class.
// in payload class
void OnFire(const D3DXVECTOR3& pos, const D3DXVECTOR3& dir)
{
m_Alive = true;
m_Pos = pos;
D3DXVec3Normalize(&m_Dir, &dir);
}
// in gameFramework class (main class)
if (m_Input->IsPressed(DIK_W)) // shoot to up
m_PlayerPM->OnFire(m_Player->getPosition(), D3DXVECTOR3(0.f, -1.f, 0.f));
if (m_Input->IsPressed(DIK_D)) // shoot to right
m_PlayerPM->OnFire(m_Player->getPosition(), D3DXVECTOR3(1.f, 0.f, 0.f));
if (m_Input->IsPressed(DIK_A)) // shoot to left
m_PlayerPM->OnFire(m_Player->getPosition(), D3DXVECTOR3(-1.f, 0.f, 0.f));