Firing Projectiles - Lets Make a Side Scrolling Shooter - Part 5 @WorldOfZeroDevelopment
Firing Projectiles - Lets Make a Side Scrolling Shooter - Part 5  @WorldOfZeroDevelopment
Uploaded July 2018 | Updated November 2026, 3 hours ago
Time to make our ship go pew., pew! We're going to add projectiles. We'll build a set of components that can fire and build projectiles. This will include the `ProjectileMovement` class for moving projectiles forward and detecting collisions, `ProjectileTimeout` for timing out projectiles and deleting old projectiles, `TimedProjectileLauncher` which will periodically fire new projectiles and finally the `DamageDisplay` for debugging projectile collisions and damage.

## Classes

### `ProjectileMovement`

This script has two functions. It will move a projectile forward and check for collisions. If it collides with an object it sends a message to the object that was hit called `OnProjectileHit` which has information about what happened. This is a handy way to pass events around between different objects in a scene.

### `ProjctileTimeout`

This is mostly to protect against any random issues where projectiles fly off the screen and continue to exist forever. After a period of time any object with this script attached will destroy itself.

### `TimedProjectileLauncher`

The thing that does the shooting. This is a constantly shooting class which count a value up and, once a threshold is reached fire a projectile and begin counting again.

### `DamageDisplay`

The damage display is just a simple helper class that reacts to the OnProjectileHit messages that are sent by the `ProjectileMovement` class. From those messages it just generates a Debug message so we know things are working.


Pew! Pew!

Come join the World of Zero Discord channel: discord.gg/hU5Kq2u
Firing Projectiles - Lets Make a Side Scrolling Shooter - Part 5I Learn How To Build Flowcharts and Signal Diagrams in Mermaid.JSCollaborative Coding with Visual Studio Live ShareRigidbody Top-Down Spaceship ControllerBuilding Coyote Time in a 2D PlatformerExploring Dot Products in UnityAutomatically Processing Assets with Custom Unity Asset PipelinesTaking a Look at Groovy @Memoized FunctionsBuilding OBS Overlays in Unity 3DAnimating the Elevator - An Elevator Between Scenes - Part 1Improving the Voxel Cube with Lighting and Optimized UpdatesExpanding our Mindustry Server with Custom Maps, Saves and More
World of Zero |

Firing Projectiles - Lets Make a Side Scrolling Shooter - Part 5

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER