Controls: [SPACE] to get the balloon to bounce. Collect money but avoid the bombs!

Purpose:

The original version of this game was buggy and was provided through Learn.Unity.com. The following bugs in scripts and the editor needed to be fixed:

  1. Player cannot control the balloon
  2. Background only moves when the game is over
  3. No objects are being spawned
  4. Fireworks appear on the side of the balloon
  5. Background is not repeating properly.

Additional functionality to be added:

  1. Balloon bounces and makes a noise when it hits the ground
  2. A upper boundary restricts the balloon flying too high

Please see the original version at: https://tedman.itch.io/buggy-balloon-flight

Since then, these bugs have been fixed and additional functionality has been added.

Methodology

  1. The player was unable to control the balloon because the balloon's rigidbody was not initialized in the Start function. Initializing it allows the AddForce function to act on the RigidBody and move the balloon.
    1. Use playerRb = GetComponent<Rigidbody>(); in Start()
  2. The background did not move because of an if statement that states the background can only move if the game is over. Setting the if statement when the game is NOT over will allow the background to move, and then stop when the game is over.
    1. if (playerControllerScript.gameOver) --> if (!playerControllerScript.gameOver)
  3. Objects did not spawn because of a typo. 
    1. InvokeRepeating("PrawnsObject" --> InvokeRepeating("SpawnObjects"
  4. Fireworks appeared on the side of the balloon because they were not made a child of the Player Game Object. Setting fireworks as the child resolves this.
  5. The background was not repeating properly because the repeatWidth utilized the background's Y value instead of its X value.
    1. repeatWidth = GetComponent<BoxCollider>().size.y --> ...size.x

Additional functionality was added with:

  1. Under the OnCollisionEnter method, an if statement that, when the player touches the "ground", the balloon's rigidbody will experience a vector3.up force. Include an line that calls upon an audioclip to be played whenever this occurs. Make sure to create a tag called "ground" and label the ground.
  2. Add a boolean that checks the height of the player. Whenever the player is above this height, prevent them from adding force. Whenever the player is below this height, they are able to add force. Additionally add a ceiling with a box collider that prevents the player from accumulating a lot of force when near the ground.


Even more improvements can be added:

  • UI screen that records amount of money collected.
  • Menu screen that features the player's top score for that session.



Leave a comment

Log in with itch.io to leave a comment.