Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
October 16, 2017
arrowPress Releases

If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Shooting Particles in Unity (For Beginners)

by Tony Yotes on 12/23/13 12:03:00 pm   Featured Blogs

2 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutras community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.


For shooter mode in TriGrid, bullet sprites just didn't cut it. They were boring crystal sprites that shattered on impact. I needed something with more flare. More Geometry Wars like. I started messing with Unity's particle systems and discovered how to make a little fire ball. One color change and explosion effect later I had the shooting effect I wanted. Here is how I got those "pew pew" thingies to work.

I basically made a looping particle emitter in a cone shape using Unity's particle editor. I made it so the effect spawns up to 1000 dots that change from light blue to lavender as the die within one third of a second.

I made the particle effect it's own object, attached physics to it, and made it a trigger so that it could collide with game objects. I attached a script I namedscriptShotso I could control what happens when it impacts something.

If you wanted to replicate my effect, here are the settings to do it. Releasing 130 particles at a time with an initial extra burst of 50 every time the loop resets. I made them move at a speed of 100 to get the speeding effect I wanted.

Stretching out the cone path that the particles were stuck inside was pretty simple. Unity has sliders you can adjust. To make the tail longer, all I'd have too do is increase the lifespan of each particle.

This is the method I used to make the player shoot particles. This was called every time the "Pew" button was pressed. It checks to see if less than 4 shots are already in play before firing. I wanted to limit the amount of active shots to make things more challenging. The player could shoot once in each direction if necessary, but that's it. A skilled player could possibly last forever, but triangles tend to sneak up on you and catch your flank.

This code changes the direction the player is facing. In Unity thetransform.eulerAnglesvariable determines where an object is facing. I do this so I only have to tell the arrow to move forward when it's in motion. The player's direction determines which way the shot spawns and which way the shot moves.

The shot only knows to go forward. At the moment of its creation it checks the direction of the player and aligns itself to match it.

When it's in play, its just a matter of moving it by 4 pixels every frame in whatever direction it's facing. Based on the way the particles orient themselves, it moves by subtracting its Z-value on the coordinate plane.

After that, it was just a matter of determining what happens when it touches stuff. I made it so enemies die on contact and walls trigger the particle effect within the particle effect that plays an explosion animation and deletes the original blast. After that I save the blast and the explosion as prefabs to be summoned whenever the player taps the "Pew" button. Suddenly, I have a Shooter mode in TriGrid.

Related Jobs

Telltale Games
Telltale Games — San Rafael, California, United States

Narrative Designer
Bohemia Interactive Simulations
Bohemia Interactive Simulations — Prague, Czech Republic

Product Owner / Team Leader
2A Consulting
2A Consulting — Seattle, Washington, United States

Graphics Developer
iGotcha Studios
iGotcha Studios — Stockholm, Sweden

Senior Game Design Lead

Loading Comments

loader image