Skip to content

Particle Shapes

Syntax-Sculptor edited this page Nov 24, 2026 · 1 revision

Introduction

So far, every emitter we've made had particles spawn from a single point, that being the emitter's position. However, what if you want to spread your particles out over an area? Fortunately, we can achieve this with the Shape module!

The Shape module allows you to set the shape of the emitter. When setting the shape, particles can spawn anywhere inside it or along its outline. This is great for various effects such as rain or a ring of fire.

Unlike other modules, Shape doesn't have an Enabled field. Instead, you pick a shape by setting Shape.Type. By default, it's set to "Point", which is what causes particles to spawn from the emitter's position.

Note

The emitter's Orientation field affects the orientation of shapes!

Circle

Setting Shape.Type to "Circle" causes particles to spawn inside a circle. You can change the size of the circle by changing the Radius field (default: 40):

local room = Game():GetRoom()
local spawnPos = room:GetCenterPos()
local emitter = Palette:CreateParticleEmitter("gfx/particle.png", spawnPos)
emitter.StartSpeed = 0
emitter.ParticleRate = 15
emitter.Shape.Type = "Circle"
emitter.Shape.Radius = 60
2026-11-23.16-46-27.mp4

The Shape module has a few additional fields that affect emitters with its shape set to "Circle":

  • RadiusThickness (default: 1): How much of the circle particles can spawn in, from the edge inwards. 1 fills the whole circle, 0.5 only uses the outer 50% (making a thick ring), and so on.
  • Arc (default: 360): How much of the circle is used, in degrees. For example, 180 only spawns particles in half of the circle.

Here's a quick example:

local room = Game():GetRoom()
local spawnPos = room:GetCenterPos()
local emitter = Palette:CreateParticleEmitter("gfx/particle.png", spawnPos)
emitter.StartSpeed = 0
emitter.ParticleRate = 40
emitter.Shape.Type = "Circle"
emitter.Shape.Radius = 70
emitter.Shape.RadiusThickness = 0.3
emitter.Shape.Arc = 270
2026-11-23.16-51-27.mp4

Rectangle

Setting Shape.Type to "Rectangle" causes particles to spawn inside a rectangle. You can set its width and height using the Size field (default: Vector(1, 1)):

local room = Game():GetRoom()
local spawnPos = room:GetCenterPos()
local emitter = Palette:CreateParticleEmitter("gfx/particle.png", spawnPos)
emitter.StartSpeed = 0
emitter.ParticleRate = 30
emitter.Shape.Type = "Rectangle"
emitter.Shape.Size = Vector(200, 80)
2026-11-23.16-53-51.mp4

Line

Setting Shape.Type to "Line" causes particles to spawn along a straight line. You can set its length with the Length field (default: 120):

local room = Game():GetRoom()
local spawnPos = room:GetCenterPos()
local emitter = Palette:CreateParticleEmitter("gfx/particle.png", spawnPos)
emitter.StartSpeed = 0
emitter.ParticleRate = 30
emitter.Shape.Type = "Line"
emitter.Shape.Length = 200
2026-11-23.16-56-34.mp4

Other Shapes

Palette offers many other shapes that you can choose from. However, this page won't cover them extensively, so below is a quick overview.

  • "Triangle": Spawns inside a triangle made from three points in Shape.Vertices.
  • "Polygon": A regular polygon with Shape.Sides sides and a size of Shape.Radius.
  • "Star": A star with Shape.Sides points. Shape.InnerRadiusRatio controls how deep the star's points are.
  • "Capsule": A pill shape, set with Shape.Radius and Shape.Length.
  • "Bezier": Spawns along a smooth curve through the points in Shape.Points.
  • "Polyline": Spawns along straight lines connecting the points in Shape.Points. Set Shape.Closed to true to connect the last point back to the first.

You can view more info regarding them in the API documentation.

Scale

Every shape can be stretched with Scale (default: Vector(1, 1)). For example, this squashes a circle into an oval:

emitter.Shape.Scale = Vector(1, 0.5)

EmitFrom

Shape.EmitFrom determines whether particles spawn within the shape itself or only along the outline. It takes two values:

  • "Area" (default): Particles spawn inside the shape's area.
  • "Edge": Particles only spawn along the shape's edges.

Direction Mode

By default, particles from a shape all move in the emitter's StartDirection no matter where they spawn. If you set DirectionMode to "Radial", each particle instead moves away from the center of the emitter, which is perfect for bursts and shockwaves:

local room = Game():GetRoom()
local spawnPos = room:GetCenterPos()
local emitter = Palette:CreateParticleEmitter("gfx/particle.png", spawnPos)
emitter.StartSpeed = 2
emitter.ParticleRate = 30
emitter.Shape.Type = "Circle"
emitter.Shape.Radius = 90
emitter.Shape.DirectionMode = "Radial"
2026-11-23.17-01-39.mp4

Example: Rain

Let's create a cool rain effect! We'll set the emitter's shape to "Line" and line it up along the top of the room:

local mod = RegisterMod("Palette Test", 1)
local Palette = include("palette_scripts.palette")

Palette:Init(mod)

mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, function()
    local room = Game():GetRoom()
    local topLeft = room:GetTopLeftPos()
    local bottomRight = room:GetBottomRightPos()
    local position = Vector(room:GetCenterPos().X, topLeft.Y - 80)

    local rain = Palette:CreateParticleEmitter("gfx/particle.png", position)
    rain.Shape.Type = "Line"
    rain.Shape.Length = bottomRight.X - topLeft.X
    rain.ParticleRate = 120
    rain.MaxParticles = 400
    rain.StartDirection = Vector(0, 1)
    rain.StartSpeed = { Min = 8, Max = 10 }
    rain.Lifetime = { Min = 30, Max = 40 }
    rain.StartScale = Vector(0.1, 0.3)
    rain.StartColor = KColor(0.6, 0.7, 1, 1)
    rain:Prewarm()
end)
2026-11-23.17-11-53.mp4

Clone this wiki locally