protected override void UpdateLevel() { spawnTimer--; if (spawnTimer <= 0) { spawnTimer = (int)(spawnTimeSecs * updatesPerSec); for (int i = 0; i < 1; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } } }
protected override void CreateLevel() { MusicPlay("sounds/level1Loop"); levelSize = new Vector2(80, 60); //set the level size CreateObject("SpaceDustPF", gameBounds.center, 0); IngameInterface.DisplayMessage("Survive for 5 minutes", 3); for (int i = 0; i < 2; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { Rammer current = (Rammer)CreateObject("RammerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { SputteringDebris current = (SputteringDebris)CreateObject("SputteringDebrisPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } ChargedShots charged = (ChargedShots)CreateObject("ChargedShotPF"); spawnTimer = (int)(spawnTimeSecs * updatesPerSec); }
protected override void UpdateLevel() { remaining = 0; foreach (DestructableObject item in destructables) { if (item.team <= 0) { remaining++; } } spawnTimer--; if (spawnTimer <= 0) { spawnTimer = (int)(spawnTimeSecs * updatesPerSec); wave++; switch (wave) { case 1: IngameInterface.DisplayMessage("Wave 1", MESSAGE_SECS); for (int i = 0; i < 1; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RandomTurner current = (RandomTurner)CreateObject("RandomTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } break; case 2: IngameInterface.DisplayMessage("Wave 2", MESSAGE_SECS); for (int i = 0; i < 1; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RandomTurner current = (RandomTurner)CreateObject("RandomTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { HomingMine current = (HomingMine)CreateObject("HomingMinePF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } break; case 3: IngameInterface.DisplayMessage("Wave 3", MESSAGE_SECS); for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } break; case 4: IngameInterface.DisplayMessage("Wave 4", MESSAGE_SECS); for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } break; default: break; } } }
protected override void CreateLevel() { MusicPlay("sounds/level1Loop"); levelSize = new Vector2(100, 80); //set the level size minSize = new Vector2(10, 8); shrinkAmount = (levelSize - minSize) / (SHRINK_SECONDS * updatesPerSec); CreateObject("SpaceDustPF", gameBounds.center, 0); IngameInterface.DisplayMessage("Kill all enemies before space collapses!", 3); for (int i = 0; i < 4; i++) { HomingMine current = (HomingMine)CreateObject("HomingMinePF", GetRandomPosition(), GetRandomAngle()); } for (int i = 0; i < 2; i++) { Blob current = (Blob)CreateObject("BlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { Rammer current = (Rammer)CreateObject("RammerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 3; i++) { RandomTurner current = (RandomTurner)CreateObject("RandomTurnerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { IndestructableDebris current = (IndestructableDebris)CreateObject("IndestructableDebrisPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } Shield shield = (Shield)CreateObject("ShieldPF"); }
private const int WAVE_TIME_SECS = 60; //60 seconds between waves protected override void UpdateLevel() { waveTimer--; //determine if there are any enemies left in the level bool noEnemies = true; foreach (DestructableObject item in destructables) { if (item.team <= 0) { noEnemies = false; break; } } //if it is time for the next wave or there are not more enemies, go to the next wave if (waveTimer <= 0 || noEnemies) { //reset waveTimer waveTimer = (int)(WAVE_TIME_SECS * updatesPerSec); //update wave numbers type++; if (type > NUM_TYPES) { type = 1; round++; } //find which type of enemies to spawn, then spawn a number equal to the round //bascially, each type is gone through one at a time then it is started at the //begining again but this time, waves make one more of that type than last time //each type also gives the user a different item, each round the item given gets stronger //a message is dispayed to the user when each wave is spawned, telling them abou the wave switch (type) { case 1: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Suttering Debris and a " + round + " power Heal item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { SputteringDebris current = (SputteringDebris)CreateObject("SputteringDebrisPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Heal heal = (Heal)CreateObject("HealPF"); heal.healthPerSecGain *= round * ITEM_POWER_INCRIMENT; break; case 2: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Aseroid(s) and a " + round + " power MultiShot item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle(), 0, random.Next(100)); current.velocity = GetRandomVelocity((int)current.maxSpeed); } MultiShots multiShot = (MultiShots)CreateObject("MultiShotPF"); multiShot.numberOfShots *= round * ITEM_POWER_INCRIMENT; break; case 3: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Lazer Emitters(s) and a " + round + " power Lazer Sword item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomGameEdge(), GetRandomAngle(), 0, random.Next(100)); current.velocity = GetRandomVelocity((int)current.maxSpeed); } LazerSword sword = (LazerSword)CreateObject("LazerSwordPF"); sword.swordLength *= round * ITEM_POWER_INCRIMENT; break; case 4: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Random Turner(s) and a " + round + " power Homing Missiles item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { RandomTurner current = (RandomTurner)CreateObject("RandomTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } HomingMissiles homing = (HomingMissiles)CreateObject("HomingMissilesPF"); homing.missileDamge *= round * ITEM_POWER_INCRIMENT; break; case 5: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Mine Layer(s) and a " + round + " power Gravity Well Controller item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } GravityWellController well = (GravityWellController)CreateObject("GravityWellControllerPF"); well.maxGravity *= round * ITEM_POWER_INCRIMENT; break; case 6: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Rotating Lazer Sentry(s) and a " + round + " power Lazer Beam item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } LazerBeam beam = (LazerBeam)CreateObject("LazerBeamPF"); beam.beamDamge = (beam.beamDamge - 1) * round * ITEM_POWER_INCRIMENT + 1; break; case 7: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Green Blob(s) and a " + round + " power Rapid Shots item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { GreenBlob current = (GreenBlob)CreateObject("GreenBlobPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } RapidShots rapid = (RapidShots)CreateObject("RapidShotsPF"); rapid.shotDamage *= round * ITEM_POWER_INCRIMENT; break; case 8: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Red Blob(s) and a " + round + " power Armor item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { RedBlob current = (RedBlob)CreateObject("RedBlobPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Armor armor = (Armor)CreateObject("ArmorPF"); armor.armorGain *= round * ITEM_POWER_INCRIMENT; break; case 9: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Blue Blob(s) and a " + round + " power Charged Shot item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { BlueBlob current = (BlueBlob)CreateObject("BlueBlobPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } ChargedShots charged = (ChargedShots)CreateObject("ChargedShotPF"); charged.shotMaxDamage *= round * ITEM_POWER_INCRIMENT; break; case 10: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Slow Turner(s) and a " + round + " power Homing Mines item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } HomingMines mines = (HomingMines)CreateObject("HomingMinesPF"); mines.maxMines = (int)(round * ITEM_POWER_INCRIMENT * mines.maxMines); mines.layTimeSecs *= round * ITEM_POWER_INCRIMENT; break; case 11: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Rammer(s) and a " + round + " power Accelerant item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { Rammer current = (Rammer)CreateObject("RammerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Accelerant accelerant = (Accelerant)CreateObject("AccelerantFP"); accelerant.accelerationPerSecGain *= round * ITEM_POWER_INCRIMENT; break; case 12: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " LazerShooter(s) and a " + round + " power Shield item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Shield shield = (Shield)CreateObject("ShieldPF"); shield.shieldWidth *= round * ITEM_POWER_INCRIMENT / 2.0f; break; default: if (type > 12) { round++; } type = 0; waveTimer = 0; Debug.Log("Veraible 'type' has an invalid value of: " + type); break; } } }
protected override void CreateLevel() { MusicPlay("sounds/level1Loop"); levelSize = new Vector2(80, 60); //set the level size CreateObject("SpaceDustPF", gameBounds.center, 0); for (int i = 0; i < 8; i++) { HomingMine current = (HomingMine)CreateObject("HomingMinePF", GetRandomPosition(), GetRandomAngle()); } for (int i = 0; i < 2; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 4; i++) { IndestructableDebris current = (IndestructableDebris)CreateObject("IndestructableDebrisPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RedBlob current = (RedBlob)CreateObject("RedBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { GreenBlob current = (GreenBlob)CreateObject("GreenBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { BlueBlob current = (BlueBlob)CreateObject("BlueBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } Armor armor = (Armor)CreateObject("ArmorPF"); }