void Player::Hit(void) { if (!m_Hit) { //Play Player explosion sound. Mix_PlayChannel(-1, p_Explosionsound, 0); m_ExplosionOn = true; m_Hit = true; SetExplosion(); //Turn off thrust sound. if (m_ThrustChannel > -1) { Mix_HaltChannel(m_ThrustChannel); m_ThrustChannel = -1; } } }
//============================================================================= // 更新処理 //============================================================================= void UpdateBillboard(void) { D3DXVECTOR3 rotCamera; // カメラの回転を取得 rotCamera = GetRotCamera(); if(GetKeyboardPress(DIK_LEFT)) { if(GetKeyboardPress(DIK_UP)) {// 左前移動 } else if(GetKeyboardPress(DIK_DOWN)) {// 左後移動 } else {// 左移動 } } else if(GetKeyboardPress(DIK_RIGHT)) { if(GetKeyboardPress(DIK_UP)) {// 右前移動 } else if(GetKeyboardPress(DIK_DOWN)) {// 右後移動 } else {// 右移動 } } else if(GetKeyboardPress(DIK_UP)) {// 前移動 } else if(GetKeyboardPress(DIK_DOWN)) {// 後移動 } if(GetKeyboardTrigger(DIK_SPACE)) {// ジャンプ if(g_bEnableGravity == true) { // 上方向へ速度を追加 g_vecBillboard.y += 10.0f; } } // ビルボードの移動 g_posBillboard.x += g_vecBillboard.x; g_posBillboard.y += g_vecBillboard.y; g_posBillboard.z += g_vecBillboard.z; // 減速 g_vecBillboard.x += (0.0f - g_vecBillboard.x) * RATE_REGIST; g_vecBillboard.y += (0.0f - g_vecBillboard.y) * RATE_REGIST; g_vecBillboard.z += (0.0f - g_vecBillboard.z) * RATE_REGIST; // 範囲外チェック if(abs(g_vecBillboard.x) < 0.1 && abs(g_vecBillboard.y) < 0.1 && abs(g_vecBillboard.z) < 0.1 && g_bUse){ g_bUse = false; SetExplosion(g_posBillboard, 10, 10); ReleaseShadow(g_nIdxShadowBillboard); //g_posBillboard.z = 0.0f; g_vecBillboard.z = 0.0f; //SetVertexBillboard(BILLBOARD_SIZE_X, BILLBOARD_SIZE_Y); //g_nIdxShadowBillboard = CreateShadow(g_posBillboard, BILLBOARD_SIZE_X, BILLBOARD_SIZE_Y); } {// 影の設定 // 位置 SetPositionShadow( g_nIdxShadowBillboard, g_posBillboard ); // サイズ float fSizeX = BILLBOARD_SIZE_X + (g_posBillboard.y - 9.0f) * 0.025f; if(fSizeX < BILLBOARD_SIZE_X) { fSizeX = BILLBOARD_SIZE_X; } float fSizeY = BILLBOARD_SIZE_Y + (g_posBillboard.y - 9.0f) * 0.025f; if(fSizeY < BILLBOARD_SIZE_Y) { fSizeY = BILLBOARD_SIZE_Y; } SetVertexShadow(g_nIdxShadowBillboard, fSizeX, fSizeY); // α値 float colA = (400.0f - (g_posBillboard.y - 9.0f)) / 800.0f; if(colA < 0.0f) { colA = 0.0f; } SetColorShadow(g_nIdxShadowBillboard, D3DXCOLOR(1.0f, 1.0f, 1.0f, colA)); } }