Game Overview
During Ludum Dare 34 we were given an option of two themes, "Two Button Controls and Growing". We were able to use both in our game if we wanted to, but I decided to go with the theme "Growing". My idea for the game came from a popular web game called Agar.io however, I wanted to take a spin on this and create it about a black hole. The objective is very simple, the idea is to grow the black hole and not die. There are two ways that you can die, getting sucked in by another black hole and getting your health removed by the "space mines". As you grow bigger the space mines will do less damage to you. I made the game slightly more challenging by shrinking the blackhole if the player doesnt eat any objects after a certain time. As the black hole grows or shrinks, I added a script to zoom the camera depending on the black hole size so that the black hole could always be visible to the player.What went well?
What can be improved?
Spawn Pickups:
A code sample taken from Spawn Pickups script that handles the rarity of different pickups and spawns them at a random distance.void SpawnObjects() { distanceBetween = Random.Range(minDistanceBetween, maxDistanceBetween); //random chance to spawn pickups if (Random.value > 0.5) { selectPickup = Random.Range(0, 4); } else if(Random.value > 0.2) { selectPickup = Random.Range(5, 9); } else if(Random.value > 0.7) { selectPickup = Random.Range(10, 14); } else if(Random.value > 0.3) { selectPickup = Random.Range(15, 18); } transform.position = new Vector2(Random.Range(0, 240), Random.Range(0, 190)); Instantiate(spawnBlocks[selectPickup], transform.position, transform.rotation); spawnTimer = 0f; }
Reduce player size:
A code sample taken from Player Controller script that checks how long has passed and if its more than 3 seconds, the player will shrink in size until they eat again.timeSinceDecay += Time.deltaTime; timeSinceEat += Time.deltaTime; if (timeSinceDecay > 0.1) { if (timeSinceEat > 3.0 && size > 9) { camera.orthographicSize -= 0.02f; float speedLost = (speed - speed * Mathf.Pow(0.998f, Time.time - timeSinceEat)) / 15; float sizeLost = (size - size * Mathf.Pow(0.998f, Time.time - timeSinceEat)) /15; AddSize(-sizeLost); IncreaseSpeed(-speedLost); timeSinceDecay = 0; } }