S&box Wiki

Revision Difference

Creating_your_first_particle_effect#529727

<cat>Dev.Particles</cat>⤶ <title>Creating your first particle effect</title>⤶ ⤶ # Creating a particle effect using sprites⤶ The first thing we need to do is add something which spawns our sprites.⤶ ⤶ * Press the `+` next to Emitter and add `Emit continuously`, when we add our sprites, this will spawn them. ⤶ * Press the `+` next to Renderer and select `Sprite Renderer`. ⤶ ⤶ You should now see the following: ⤶ <upload src="3dc48/8d90824bd202cb8.png" size="370922" name="image.png" />⤶ Right now it's just one giant blob, but before we change that, we should stop it from spawning infinite particles.⤶ ⤶ * Press the `+` next to `Operator` and add `Lifespan Decay`, this will kill particles after a small amount of time. ⤶ ⤶ Now let's change how our sprites are spawned.⤶ ⤶ * Press the `+` next to `Initializer` and select `Position Along Ring`. ⤶ ⤶ Nothing changed, and that is because we need to set the radius of our ring. ⤶ ⤶ Press `Position along ring` and you should see the properties for it. ⤶ <upload src="3dc48/8d90825da5cecf3.png" size="55644" name="image.png" />⤶ ⤶ * Now set the `initial radius` property to 10, and you should now see a donut shape.⤶ <upload src="3dc48/8d908253e2b77f5.png" size="570583" name="image.png" />⤶ ⤶ Congratulations! You just created your first particle effect using the Sprite Renderer. ⤶ ⤶ ## Spicing up the sprites ⤶ You can play with the properties on the functions you've added.⤶ Here's a few suggestion for what you can do: ⤶ * On `Render sprites` change the `color blend`, and the `radius scale` properties.⤶ * On `Emit Continuously` change the `emission rate` property to spawn more or less particles. ⤶ * On `Operator` add `Movement Basic` and play with the `gravity` property (try setting it to 0, 0, 40)⤶ * Add a custom sprite. Follow the wiki guide here: <page>using_custom_sprites</page>