Golf Cannon Game

Controls

1,2,3,4,5,6,7,8 - Switches levels based on which number you click in relation to the level name.

W,A,D - Jumps, Moves Left, Moves Right (only in some levels).

Mouse 1 - Hold down to shoots Base Bullet.

Spacebar   - Hold down to engage turbo boost function.


Level 1

Level 1 is simple, hold down spacebar to engage turbo boost function and aim using mouse to hit the target. Once Target is hit the level switches.

Level 2

Level 2  has a wall and a black hole, to get around the black hole you use the gravitational force of the black hole to slingshot the turbo bullet over the wall and into the target.

Level 3

Level 3  is a maze, use W,A,D to navigate your cannon around the maze until you get to the end where you can shoot the target. Camera follows the cannon as the cannon is the object that moves instead of the bullet (I think I misinterpreted what I was suppose to do for this level).

Level 4

Level 4 has a door, you need to shoot the door 3 times to destroy (open) it. Each shot increases red color intensity.

Level 5

Level 5 has checkpoints, each time you shoot the circle target checkpoint object it opens/destroys the barrier until you have a clear shot to shoot the target.

Level 6

Level 6 has a trip wire, you must push the white box into the red tripwire box to open/destroy the barrier. When the box is activating the trip wire the you have a clear shot at the target.

Level 7

Level 7 has a sticky wall or roof to be exact. When the bullet collides with a specified object the bullet sticks the the object.

Level 8

Level 8 has a turret. The turret tracks the players movement  and always aims at the player. When the player enters the activation radius the turret starts shooting at the the player, rocket bullet is programmed to track the players position (Seeking Rocket).


How it is made

The game consists of 9 scenes, Main Menu and Level 1 - 8.  Using ChatGPT and a little of my own programming knowledge, the game consists of 14 scripts that control the aspects of the game. These scripts are:

  • AudioManagerScript - This is responsible for storing each sound effect, I used the audio source component to control the sound effects so I have control where the audio sources is located in the scene and all the settings I need as opposed of just calling an audio clip from the assets window
  • BlackHoleScript - This is the script attached to the blackhole, this gives the objects trigger collider a gravitational force.
  • BulletSmokeTrailScript - This script is attached to each  bullet prefab, this controls the rendered smoke trail.
  • BulletStickScript - This script is attached to the objects that make the bullets stick to that object. It freezes the x,y,z location on collision.
  • CannonController  - This is the biggest script, it controls all things to do with the cannon.
  • CheckpointCollisionScript - This script is attached to the checkpoint circle  object that destroys the barriers. 
  • DoorwayCollisionScript - This Script destroys the   door object upon 3 direct hits while increasing the color of red each collision.
  • EnemyTurretController - This script is similar to the CannonController expect it only controls the enemy turrets AI .
  • MovementController - This script is attached to the cannon controller in some of the levels where moving in involved, moves left and right and jumps
  • SceneController - This script is responsible for the golf terminology, it basically collects data from every time the a bullet has been fired and calculates the correct golf term based  on how many times the bullet fired before the target was hit and displays a message using text mesh pro. It also switches scenes after 2 seconds since the target has been hit. The script is attached to the target object.
  •  SceneLoaderScript -  This script is attached to each button in the level select menu. It Switches to the specified scene that correlates the the button using the on click event function in the button component.
  • SceneSwitcherKeys - Loads the level based on which number you click, number 7 on your keyboard loads  level 7 for example.
  • TripwireCollisionScript - This script is attached to the white box you push into the tripwire, when the white box collides with the specified collider it disables the barrier until you move the white box off the tripwire.


Graphics and Sprites

The Cannon sprite was made by me using Microsoft paint and paint.net. The target was downloaded  royalty free off the internet  and edited with paint.net to make the background transparent. The bullet/golf ball was also royalty free downloaded off the internet and edited with paint.net to remove the background. The background was downloaded royalty free from the internet and separated into two images using paint.net, the ground has a higher priority then the mountains and sky  so that the rendered line trajectory wont appear over the ground. The maze tile map was made by AxulArt and  downloaded from itch.io    (referenced bellow).


References 

Maze Tile Map by AxulArt:

https://axulart.itch.io/dirt-and-grass-2d-platform-tileset







Leave a comment

Log in with itch.io to leave a comment.