void Init_Explosions(void) { //cout<<"Init_Explosions"<<endl; AddExplosion("data/explosions/explo1.png"); AddExplosion("data/explosions/explo2.png"); AddExplosion("data/explosions/explo1.png"); AddExplosion("data/explosions/explo2.png"); }
void CDecalsDrawerGL4::ExplosionOccurred(const CExplosionParams& event) { if ((event.weaponDef != nullptr) && !event.weaponDef->visuals.explosionScar) return; if (!ExplosionInAirLos(event)) return; AddExplosion(event.pos, event.damages.GetDefault(), event.craterAreaOfEffect); }
/* * DisplayOtherUnits * * Display all the units on the screen. First, we need * to move each of the units to their new positions. * Some of this is done in the AI module. * */ void DisplayOtherUnits (GdkPixmap *pixmap, GtkWidget *drawing_area) { typUnit *unit; typUnit *unitHit; GList *node; int xPos; int xPosEnd; typSprite *sprite; /* --- Each unit in the list --- */ for (node = unitList; node; node = node->next) { /* --- Get the unit --- */ unit = (typUnit *) node->data; /* * --- Run the AI module on it to move it --- */ AIModule (unit); /* * If the unit was destroyed by the AI, * don't draw the unit. */ if (unit->bDestroy) { continue; } /* * If there's no sprite for the unit, * we can't draw it now, can we? */ sprite = GetSprite (unit); if (sprite == NULL) continue; /* --- Where on the screen is it going? --- */ xPos = UnitScreenX (unit); /* --- Make sure unit doesn't go out of bounds --- */ AdjustSpriteHeight (unit); /* --- Finally draw unit --- */ DisplaySprite (drawing_area, sprite, (int) (xPos - sprite[0].width / 2), (int) (unit->y - sprite[0].height / 2)); } /* * --- once everyone is painted, fire the lasers. */ for (node = unitList; node; node = node->next) { unit = (typUnit *) node->data; /* --- If this is a laser --- */ if (unit->type == LASER) { /* --- Get starting and ending positions --- */ xPos = ScreenX ((int) unit->x); xPosEnd = xPos + LASER_LENGTH * unit->direction; /* --- See if anything was hit --- */ unitHit = AnyoneBetween ((int) xPos, (int) unit->y, (int) xPosEnd, (int) unit->y); if (unitHit) { /* --- Something was hit --- */ /* --- Laser shot only goes this far --- */ xPosEnd = UnitScreenX (unitHit); /* --- Destroy the unit --- */ unitHit->bDestroy = TRUE; unit->bDestroy = TRUE; /* --- Special effects of destruction --- */ AddExplosion (unitHit); } /* --- Draw the laser --- */ gdk_draw_line (pixmap, penWhite, xPos, unit->y, xPosEnd, unit->y); /* --- Get real coordinates of laser --- */ unit->x = GameX (xPosEnd); /* --- If laser has gone too far... --- */ if (DistanceBetween (unit, hero) > nScreenWidth / 2) { /* --- destroy it --- */ unit->bDestroy = TRUE; } } } }
void CProjectile::AddImpact(HOBJECT hObj, LTVector vFirePos, LTVector vImpactPos, LTVector vSurfaceNormal, SurfaceType eType) { // Create the client side weapon fx... CLIENTWEAPONFX fxStruct; fxStruct.hFiredFrom = m_hFiredFrom; fxStruct.vSurfaceNormal = vSurfaceNormal; fxStruct.vFirePos = vFirePos; fxStruct.vPos = vImpactPos + (m_vDir * -1.0f); fxStruct.hObj = hObj; fxStruct.nWeaponId = m_pWeaponData->nId; fxStruct.nAmmoId = m_pAmmoData->nId; fxStruct.nSurfaceType = eType; fxStruct.wIgnoreFX = g_wIgnoreFX; // Always use the flash position for the first call to AddImpact... if (m_bNumCallsToAddImpact == 0) { fxStruct.vFirePos = m_vFlashPos; } // If we do multiple calls to AddImpact, make sure we only do some // effects once :) g_wIgnoreFX |= WFX_SHELL | WFX_LIGHT | WFX_MUZZLE; // Allow exit surface fx on the next call to AddImpact... g_wIgnoreFX &= ~WFX_EXITSURFACE; if (IsMoveable(hObj)) { // Well, don't do too many exit marks...The server will add one // if necessary... g_wIgnoreFX |= WFX_EXITMARK; } // If this is a player object, get the client id... if (IsPlayer(m_hFiredFrom)) { CPlayerObj* pPlayer = (CPlayerObj*) g_pLTServer->HandleToObject(m_hFiredFrom); if (pPlayer) { fxStruct.nShooterId = (uint8) g_pLTServer->GetClientID(pPlayer->GetClient()); } } CreateClientWeaponFX(fxStruct); // Do the area and progressive (over time) damage... if ((m_pAmmoData->nAreaDamage > 0.0f && eType != ST_SKY) || m_pAmmoData->fProgDamageLifetime > 0.0f) { AddExplosion(vImpactPos, vSurfaceNormal); } // Update Character fire info... if (m_hFiredFrom && IsCharacter(m_hFiredFrom) && CanSetLastFireInfo()) { CCharacter* pChar = (CCharacter*)g_pLTServer->HandleToObject(m_hFiredFrom); if (pChar) { CharFireInfo info; info.hObject = hObj; info.vFiredPos = m_vFlashPos; // Use initial flash pos info.vImpactPos = vImpactPos; info.nWeaponId = m_pWeaponData->nId; info.nAmmoId = m_pAmmoData->nId; info.fTime = g_pLTServer->GetTime(); info.bSilenced = m_bSilenced; info.eSurface = eType; pChar->SetLastFireInfo(&info); } } m_bNumCallsToAddImpact++; }
void CDebris::Create(DVector vDir, DFLOAT fDamage) { if (!g_pServerDE) return; // HCLASS hClass = g_pServerDE->GetClass( "CClientGibFX" ); // if( !hClass ) // return; VEC_NEGATE(vDir, vDir); DFLOAT fVelFactor = 1.0f; // DDWORD nType = m_eType*10; // if (nType == SURFTYPE_STONE || nType == SURFTYPE_METAL) // fVelFactor = 0.75f; DFLOAT fVel = 50.0f + fDamage; vDir.y -= 1.0f; VEC_NORM(vDir); VEC_MULSCALAR(vDir, vDir, fVel); // ObjectCreateStruct ocStruct; // INIT_OBJECTCREATESTRUCT(ocStruct); DVector vPos; g_pServerDE->GetObjectPos(m_hObject, &vPos); if (m_bExploding) AddExplosion(vPos); // VEC_COPY(ocStruct.m_Pos, vPos); // g_pServerDE->GetObjectRotation(m_hObject, &ocStruct.m_Rotation); DVector vDims; g_pServerDE->GetObjectDims( m_hObject, &vDims ); DDWORD dwCustom = (m_hstrModel1 || m_hstrTexture1 || m_hstrSound) ? TYPEFLAG_CUSTOM : 0; // CClientGibFX* pGib; if (m_bStone /* && (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct)) */) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_STONE/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_STONE/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bMetal /* && (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct)) */) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_METAL/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_METAL/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bWood /* && (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct)) */) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_WOOD/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_WOOD/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bTerrain /*&& (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct)) */) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_TERRAIN/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_TERRAIN/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bPlastic /*&& (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct))*/) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_PLASTIC/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_PLASTIC/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bGlass /*&& (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct))*/) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_GLASS/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_GLASS/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bFlesh /*&& (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct))*/) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_FLESH/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_FLESH/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bLiquid /*&& (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct))*/) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_LIQUID/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_LIQUID/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } if (m_bEnergy /*&& (pGib = (CClientGibFX*)g_pServerDE->CreateObject(hClass, &ocStruct))*/) { // pGib->Setup(&vPos, &vDir, &vDims, SURFTYPE_ENERGY/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, // m_hstrModel1, m_hstrTexture1, m_hstrSound); SetupClientGibFX(&vPos, &vDir, &vDims, SURFTYPE_ENERGY/10 | SIZE_SMALL | dwCustom, m_fScale, m_nAmount, m_hstrModel1, m_hstrTexture1, m_hstrSound); } }
void nGame::Process() { static float absoluteTime = 0.0f; static float absoluteTime2 = 0.0f; // Check for pause key if(nGetInstance()->GetInput()->GetKeyboard()->GetNewKey(DIK_PAUSE) || nGetInstance()->GetInput()->GetKeyboard()->GetNewKey(DIK_P)) SetPause(!GetPause()); // Don't process further if paused if(m_Pause) return; absoluteTime += nGetInstance()->GetElapsedTime(); absoluteTime2 += nGetInstance()->GetElapsedTime(); // Create enemy missle if enough time passed if(absoluteTime > m_MissleTime) { // Reset the timer absoluteTime = 0.0f; if(m_MissleTime > 1.0f) m_MissleTime -= (double)nGetInstance()->GetElapsedTime() / 4.0f; // Create a missle at a random top position going to a random bottom position AddMissle(nVector2(randf(0.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cx),0.0f),nVector2(randf(0.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cx),nGetInstance()->GetGraphics()->GetDisplaySize().cy),1.0f,80.0f,GAME_ENEMY_COLOR,false,true); } // Create child enemy missle if enough time passed if(absoluteTime2 > 100.0f) { // Reset the timer absoluteTime2 = 0.0f; if(m_Missles.size()) { // Create a missle at a random trail of a nother missle unsigned long count = 1 + rand() % 3; Missle* missle = &m_Missles[rand() % m_Missles.size()]; // Find a live enemy missle while(missle->frendly || missle->dead > 0.0f) missle = &m_Missles[rand() % m_Missles.size()]; nVector2 dir = missle->position - missle->source; float length = dir.Length(); dir.Normalize(); nVector2 source = missle->source + dir * randf(0.0f,length); for(unsigned long i = 0; i < count; i++) AddMissle(source,nVector2(randf(0.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cx),nGetInstance()->GetGraphics()->GetDisplaySize().cy),1.0f,80.0f,GAME_ENEMY_COLOR,false,true); } } // Check left missle silo launch if(nGetInstance()->GetInput()->GetMouse()->GetNewButton(nMouse::ButtonLeft)) FireSilo(m_Silos[0],nGetInstance()->GetInput()->GetMouse()->GetPosition(),20.0f,80.0f,true); // Check right missle silo launch if(nGetInstance()->GetInput()->GetMouse()->GetButton(nMouse::ButtonRight)) { // Get a random vector in a sphere domain nVector2 miss(randf(-1.0f,1.0f),randf(-1.0f,1.0f)); miss.Normalize(); miss *= randf(0.0f,50.0f); FireSilo(m_Silos[1],nGetInstance()->GetInput()->GetMouse()->GetPosition() + miss,30.0f,20.0f,false); } // Remove silo fire time for(unsigned long i = 0; i < m_Silos.size(); i++) { Silo* silo = &m_Silos[i]; // Remove some fire time silo->time -= nGetInstance()->GetElapsedTime(); // Check if all/too much fire time was removed if(silo->time < 0.0f) silo->time = 0.0f; } // Move missles and remove dead ones for(unsigned long i = 0; i < m_Missles.size(); i++) { Missle* missle = &m_Missles[i]; if(missle->position == missle->destination || missle->dead > 0.0f) { if(missle->position == missle->destination && !missle->frendly && missle->dead == 0.0f) { // Players base got hit SetHealth(GetHealth() - 10); // Check if player dead if(!GetHealth()) { // Game over AddHiScore(m_Score); RestartGame(); return; } } if(missle->dead > 10.0f) { // Remove missle RemoveMissle(i--); continue; } if(missle->dead == 0.0f) { // Explode AddExplosion(missle->position,missle->blast,4.0f,nColor(1.0f,0.1f,1.0f)); } missle->dead += nGetInstance()->GetElapsedTime(); continue; } if(missle->target > 0.0f) missle->target -= nGetInstance()->GetElapsedTime() / 10.0f; else if(missle->target < 0.0f) missle->target = 0.0f; nVector2 velocity = missle->destination - missle->source; velocity.Normalize(); velocity *= missle->speed * nGetInstance()->GetElapsedTime(); if(velocity.x > 0.0f && missle->position.x + velocity.x > missle->destination.x) missle->position.x = missle->destination.x; else if(velocity.x < 0.0f && missle->position.x + velocity.x < missle->destination.x) missle->position.x = missle->destination.x; else missle->position.x += velocity.x; if(velocity.y > 0.0f && missle->position.y + velocity.y > missle->destination.y) missle->position.y = missle->destination.y; else if(velocity.y < 0.0f && missle->position.y + velocity.y < missle->destination.y) missle->position.y = missle->destination.y; else missle->position.y += velocity.y; } // Expand explosions and remove dead ones for(unsigned long i = 0; i < m_Explosions.size(); i++) { Explosion* explosion = &m_Explosions[i]; if(explosion->size == explosion->power) { // Remove it RemoveExplosion(i--); continue; } float expansion = explosion->speed * nGetInstance()->GetElapsedTime(); if(explosion->size + expansion > explosion->power) explosion->size = explosion->power; else explosion->size += expansion; // Check if the explosion destroyed any missles for(unsigned long j = 0; j < m_Missles.size(); j++) { Missle* missle = &m_Missles[j]; // Skip frendly or already dead missles if(missle->frendly || missle->dead > 0.0f) continue; nVector2 dir = missle->position - explosion->position; unsigned long points = 0; if(dir.Length() < explosion->size) { // Set death time missle->dead += nGetInstance()->GetElapsedTime(); // Create some particles for(unsigned long k = 0; k < 50; k++) { // Get a random vector in a sphere domain nVector2 velocity(randf(-1.0f,1.0f),randf(-1.0f,1.0f)); velocity.Normalize(); velocity *= randf(0.0f,5.0f); AddParticle(missle->position,velocity,nVector2(0.0f,0.1f),10.0f,GAME_COLOR_PARTICLES); } // Add player points points++; } // Add score if(points > 1) SetScore(GetScore() + points + points / 2); else SetScore(GetScore() + points); } } // Move and remove particles for(unsigned long i = 0; i < m_Particles.size(); i++) { Particle* particle = &m_Particles[i]; // Remove the particle if it's dead if(particle->lived >= particle->life) { // Remove it RemoveParticle(i--); continue; } particle->lived += nGetInstance()->GetElapsedTime(); particle->velocity += particle->force * nGetInstance()->GetElapsedTime(); particle->position += particle->velocity * nGetInstance()->GetElapsedTime(); } }
void IWater::ExplosionOccurred(const CExplosionEvent& event) { AddExplosion(event.GetPos(), event.GetDamage(), event.GetRadius()); }
void CProjectile::AddImpact(DVector vPoint, DVector vNormal, HOBJECT hObj) { // Compute a normal vector // Cast a ray to see what we hit DVector tempPos; IntersectQuery iq; IntersectInfo ii; SurfaceType eType = SURFTYPE_UNKNOWN; DBYTE nFX = 0; VEC_NORM(m_vDir); VEC_MULSCALAR(m_vDir, m_vDir, 2.0f); VEC_SUB(iq.m_From, vPoint, m_vDir); VEC_MULSCALAR(m_vDir, m_vDir, 10.0f); VEC_ADD(iq.m_To, vPoint, m_vDir); iq.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID; iq.m_FilterFn = NULL; iq.m_pUserData = NULL; if (hObj && g_pServerDE->IntersectSegment(&iq, &ii)) { VEC_COPY(vNormal, ii.m_Plane.m_Normal); eType = GetSurfaceType(ii.m_hObject, ii.m_hPoly); VEC_COPY(tempPos, ii.m_Point); } else // Fake it { VEC_NEGATE(vNormal, m_vDir); VEC_COPY(tempPos, vPoint); } if(m_bExplosion) { AddExplosion(tempPos, vNormal); nFX |= WFX_SCREENSHAKE; } if(m_bClientFX) { CServerDE* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) return; /* ObjectCreateStruct theStruct; INIT_OBJECTCREATESTRUCT(theStruct); VEC_COPY(theStruct.m_Pos, vPoint); HCLASS hClass = pServerDE->GetClass("CClientWeaponSFX"); CClientWeaponSFX *pWeaponFX = DNULL; if(hClass) pWeaponFX = (CClientWeaponSFX*)pServerDE->CreateObject(hClass, &theStruct); */ DDWORD nFX = WFX_SCREENSHAKE; DDWORD nExtras = WFX_EXTRA_DAMAGE; WeaponFXExtras ext; ext.fDamage = m_fDamage; // if(pWeaponFX) SendWeaponSFXMessage(&vPoint, &vPoint, &vNormal, &vNormal, nFX, nExtras, &ext); } }
void ModuleSphere::OnCollision(Collider* c1, Collider* c2) { for (uint i = 0; i < MAX_ACTIVE_SPHERES; ++i) { if (active[i] != nullptr && active[i]->collider == c1) { if (c2->type == COLLIDER_LEFT_WALL || c2->type == COLLIDER_RIGHT_WALL){ active[i]->speed.x *= -1; App->audio->PlayEffects(bounce); } else if ((c2->type == COLLIDER_WALL || c2->type == COLLIDER_SPHERE) && active[i]->speed.y != 0) { App->audio->PlayEffects(bounce); active[i]->speed.x = 0; active[i]->speed.y = 0; App->board->CheckPosition(active[lastSphere - 1]); bubbleList.push_back(active[i]); active[i]->checked = true; active[i]->CheckBobble(); if (bubbleList.n_elements >= 3) { App->audio->PlayEffects(explosion); checkDown = true; for (i = 0; i < bubbleList.n_elements; i++) { bubbleList[i]->doomed = true; App->board->board[bubbleList[i]->board_index]->Empty = true; App->player->score += 20; } } for (unsigned int i = 0; i < lastSphere; i++) { if (active[i] == nullptr) continue; if (active[i]->checked == true){ active[i]->checked = false; } if (active[i]->doomed == true) { active[i]->collider->to_delete = true; AddExplosion(active[i]); active[i]->collider = nullptr; active[i] = nullptr; } } bubbleList.clear(); if (checkDown == true){ for (int i = 0; i < App->spheres->lastSphere; i++){ if (active[i] == nullptr) continue; if (App->spheres->active[i]->board_index < 8){ bubbleList.push_back(active[i]); } } for (int i = 0; i < bubbleList.size(); i++){ if (bubbleList[i]->checked == false){ bubbleList[i]->checked = true; bubbleList[i]->CheckBobbleDown(); } } for (int i = App->spheres->lastSphere - 1; i >= 0; i--){ if (active[i] == nullptr || active[i]->collider == nullptr) continue; if (App->spheres->active[i]->checked == false){ active[i]->collider->to_delete = true; active[i]->collider = nullptr; active[i]->speed.y = 7.0f; App->board->board[active[i]->board_index]->Empty = true; } } for (unsigned int i = 0; i < App->spheres->lastSphere; i++) { if (active[i] == nullptr) continue; if (active[i]->checked == true){ active[i]->checked = false; } } bubbleList.clear(); checkDown = false; } if (App->player->mystate == POSTUPDATE){ App->player->mystate = PREUPDATE; nextSphere = true; if (App->player->bobble_down == App->player->bobble_counter) { if (App->player->godmode == false){ App->player->timesDown++; App->board->RoofDown(App->board->counter); App->audio->PlayEffects(roof); App->player->bobble_counter = 0; } else{ App->player->bobble_counter = 0; } } } } } } }
void ManagerModel::ProcessCollisions(const std::vector<CollisionPair> &collisions) { for (const CollisionPair &pair : collisions) { Player *player = GET_ENTITY(Player, ENTITY_PLAYER, pair); Shot *shot = GET_ENTITY(Shot, ENTITY_BULLET, pair); Asteroid *asteroid = GET_ENTITY(Asteroid, ENTITY_ASTEROID, pair); HealthPackage *healthPackage = GET_ENTITY(HealthPackage, ENTITY_HEALTHPACKAGE, pair); EnemieBoss *enemieBoss = GET_ENTITY(EnemieBoss, ENTITY_ENEMIEBOSS, pair); EnemieBossShot *enemieBossShot = GET_ENTITY(EnemieBossShot, ENTITY_BULLETENEMIEBOSS, pair); if (player && asteroid) { int type = asteroid->mType; if (player->mHealth == player->defaultHealth / 2) { if (player->mFrameTimeIsHit <= 0) { AddExplosion(player->GetPosition(), ENTITY_PLAYER); SetHealth(0); RemoveEntity(player); RemoveEntity(asteroid); player->isHit = false; mLostRound = true; AddAsteroid(type, 2, Vec2(1, 1), Vec2(0)); } } else { player->Hit(); SetHealth(player->mHealth); AddExplosion(asteroid->GetPosition(), ENTITY_PLAYER); RemoveEntity(asteroid); AddAsteroid(type, 2, Vec2(1, 1), Vec2(0)); } } else if (asteroid && shot) { RemoveEntity(shot); if (asteroid->mHealth == asteroid->defaulthealth) { Vec2 pos = Vec2(asteroid->mPos.x, asteroid->mPos.y); float health = asteroid->defaulthealth / 2; int type = asteroid->mType; RemoveEntity(asteroid); AddScore(1); AddAsteroid(type, 2, Vec2(health / 100, health / 100), pos); } else if (asteroid->mHealth == asteroid->defaulthealth / 2) { AddExplosion(asteroid->GetPosition(), ENTITY_ASTEROID); if (mCountAsteroids == 4) { AddAsteroid(asteroid->mType, 2, Vec2(1, 1), Vec2(0)); mCountAsteroids = 0; } else { ++mCountAsteroids; } RemoveEntity(asteroid); AddScore(2); } } else if (healthPackage && player) { RemoveEntity(healthPackage); player->mHealth = player->defaultHealth; player->isHit = false; player->mFrameTimeIsHit = player->coolDownIsHit; } else if (enemieBoss && shot) { RemoveEntity(shot); enemieBoss->Hit(); AddScore(1); if (enemieBoss->mHealth <= 0) { RemoveEntity(enemieBoss); AddExplosion(enemieBoss->mPos, ENTITY_ENEMIEBOSS); } else { AddExplosion(enemieBoss->mPos, ENTITY_ASTEROID); } } else if (enemieBossShot && player) { if (player->mHealth == player->defaultHealth / 2) { if (player->mFrameTimeIsHit <= 0) { AddExplosion(player->GetPosition(), ENTITY_PLAYER); SetHealth(0); RemoveEntity(player); player->isHit = false; mLostRound = true; } } else { player->Hit(); SetHealth(player->mHealth); } } else if (player && enemieBoss) { RemoveEntity(player); AddExplosion(player->GetPosition(), ENTITY_PLAYER); player->isHit = true; mLostRound = true; } else if (asteroid && !player && !shot) { //RemoveEntity(pair.mEntityA); //RemoveEntity(pair.mEntityB); } } }