2D Particle Emitter

This module aims to mimic the existing Roblox ParticleEmitter object to make it easier to create 2d particles and port over existing particle emitters (with a few tweaks of course!)

Short video of this module in action, along with a comparison:


Notable changes that you have to account for when making your own particle emitter:

  • Speed determines how much the particle progresses in pixels (offset) per second.
  • Size is in offset.

You can get and view the source code via Github or the Roblox Creator Store.
A quick usage example can be found within the Github provided above.

24 Likes

Here is another demonstration of what this module is capable of.
Made these today for my game which took a few hours to do.

RobloxStudioBeta_F26Pe9MwQw

5 Likes

2D Particle Emitter v0.0.3

  • Replaced math.random with the Random class internally
  • Added .fromParticle constructor function which lets you create a 2d particle object using an existing particle emitter as a base

Example usage:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ParticleEmitter = require(ReplicatedStorage:WaitForChild("ParticleEmitter"))

-- Size & Speed are being set here because they work very differently
-- from regular ParticleEmitters

local sparklesEmitter = ParticleEmitter.fromParticle(script.ParticleEmitter)
sparklesEmitter.Size = NumberSequence.new({
	NumberSequenceKeypoint.new(0, 3.75),
	NumberSequenceKeypoint.new(0.175, 15),
	NumberSequenceKeypoint.new(1, 0),
})

sparklesEmitter.Speed = 15
sparklesEmitter.Parent = script.Parent
2 Likes

Will i have to spend a few hours to set this up too

we ALL will be using TS module (good module, imma use it for my game

4 Likes

Nope, it only took a few hours because I had to come up with ideas for these particles
Refer to the example given above or within the Github to get started

2 Likes

The rainbow text on the bottom isn’t a particle effect or am I mistaken?

It’s not. It just happened to be included in the gif

Very interesting. I will check it out.
Mind adding these demonstrations to the github?

Sorry these demonstrations were made specifically for my game so I can’t make them public. However I can make some example particles next week since I’m on vacation right now.

Pretty straight forward to use. Thanks for the contribution!

-- Script 1
local ParticleEmitterModule = require(ReplicatedStorage.Modules:WaitForChild("2DParticleEmitter"))

local Visuals = {}

function Visuals.CreateHealthGainEmitter(parent)
	local emitter = ParticleEmitterModule.new()
	emitter.Parent = parent
	emitter.Texture = "rbxassetid://80066527587562"
	emitter.Color = ColorSequence.new(Color3.fromRGB(50, 255, 50))
	emitter.Size = NumberSequence.new({
		NumberSequenceKeypoint.new(0, 28),
		NumberSequenceKeypoint.new(0.5, 36),
		NumberSequenceKeypoint.new(1, 18),
	})
	emitter.Transparency = NumberSequence.new({
		NumberSequenceKeypoint.new(0, 0),
		NumberSequenceKeypoint.new(0.7, 0.2),
		NumberSequenceKeypoint.new(1, 1),
	})
	emitter.ZOffset = 5
	emitter.EmissionDirection = "Top"
	emitter.Lifetime = NumberRange.new(0.8, 1.3)
	emitter.Speed = NumberRange.new(30, 50)
	emitter.SpreadAngle = 25
	emitter.RotSpeed = NumberRange.new(-45, 45)
	emitter.Rotation = NumberRange.new(0, 360)
	emitter.Enabled = false
	return emitter
end

return Visuals
--Script 2
local healthGainEmitter = Visuals.CreateHealthGainEmitter(ParticleFrame)
-- this fires when my local player gains more than 1% max hp
healthGainEmitter:Emit(1)
2 Likes