Skip to content

Tunnel shooter

Another assignment in the programming course for Unity. We got to make whatever we wanted so I went for a classic tunnel shooter.

  • Controlled by an Xbox controller.
  • Auto generated levels (the placements of the blocks and enemies)
  • Spawn points
  • Pooled bullets
  • Auto increasing of speed
  • Homing and exploding enemies
  • Several camera angles with automatic obstruction prevention using raycasts.
  • Simple score GUI

Hard lesson learned: Always make sure to set the layers to the right layer. The thrust trail from the space ship had accidentally ended up in the wrong layer, and was thusly not ignored by the raycast that determines if the follow camera has been obstructed. Result: the camera seemed laggy and jittery/jerky. I thought it was an issue with Update vs FixedUpdate for the longest time.

Lesson two: Fast travelling small objects that are intended to hit other objects are annoying to deal with. Had to use raycasts from previous frame position to current frame position to determine if something was hit in-between frames.