Exemplo n.º 1
0
void Enemy::addDamage(int dmg) {
    shield -= dmg;
    if (shield <= 0) {
        // Destroyed.
        addBonuses();
        manager->addScore(ENEMY_TYPE_SCORE[type->type]);
        if (isBoss) {
            addFragments(15, 0, 0.1, rand.nextSignedFloat(1));
            SoundManager::playSe(SoundManager::BOSS_DESTROYED);
            manager->setScreenShake(20, 0.05);
            manager->clearBullets();
            removeTopBullets();
            dstCnt = DESTROYED_CNT;
        } else {
            float d;
            if (type->type == EnemyType::SMALL) {
                d = moveBullet->bullet->deg;
                SoundManager::playSe(SoundManager::ENEMY_DESTROYED);
            } else {
                d = rand.nextSignedFloat(1);
                SoundManager::playSe(SoundManager::LARGE_ENEMY_DESTROYED);
            }
            addFragments(type->type * 4 + 2, 0, 0.04, d);
            remove();
        }
    }
    damaged = true;
}
Exemplo n.º 2
0
void Enemy::addDamageBattery(int idx, int dmg) {
    battery[idx].shield -= dmg;
    if (battery[idx].shield <= 0) {
        // Wing is destroyed.
        Vector* p = &(type->batteryType[idx].collisionPos);
        addBonuses(p, type->batteryType[idx].shield);
        manager->addScore(ENEMY_WING_SCORE);
        addWingFragments(type->batteryType[idx], 10, 0, 0.1, rand.nextSignedFloat(1));
        SoundManager::playSe(SoundManager::LARGE_ENEMY_DESTROYED);
        manager->setScreenShake(10, 0.03);
        removeBattery(&(battery[idx]), type->batteryType[idx]);
        vel.x = -p->x / 10;
        vel.y = -p->y / 10;
        velCnt = 60;
        removeTopBullets();
        fireCnt = velCnt + 10;
    }
}
void CvMapGenerator::addGameElements()
{
	addRivers();
	gDLL->logMemState("CvMapGen after add rivers");

	addLakes();
	gDLL->logMemState("CvMapGen after add lakes");

	addFeatures();
	gDLL->logMemState("CvMapGen after add features");

	addBonuses();
	gDLL->logMemState("CvMapGen after add bonuses");

	addGoodies();
	gDLL->logMemState("CvMapGen after add goodies");

	// Call for Python to make map modifications after it's been generated
	afterGeneration();
}
Exemplo n.º 4
0
void Enemy::addBonuses() {
    addBonuses(0, type->shield);
}