UuSpace Shooter Progression Report: Enemies & Power Ups
An essential part of a game loop in any game is Enemies. For this mini-project we will keep it simple.
To help create enemies almost endlessly, we created a Spawn Manager to control the instantiation using a simple coroutine that created enemies at random positions on the X-Axis
var posToSpawn = new Vector3(Random.Range(-8f, 8f), 7f, 0);
var enemy = Instantiate(_enemyPrefab, posToSpawn , Quaternion.identity);
enemy.transform.parent = _enemiesContainer.transform;yield return new WaitForSeconds(_enemySpawnTime);
The above code ensures the continues spawning of enemies as long as the player is alive.
To make things a little more challenging, the enemies shoot a laser that does double the damage.
Spawning power ups followed the same logic as spawning enemies. For now there are 3 power ups that spawn repeatedly.
- Shield power up that gives player immunity against one damage
- Speed power up that gives the player a speed boost
- Triple Shot power up that allows the player to shoot 3 lasers at the same time for few seconds