Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Getting Started

PossiblyAxolotl edited this page Feb 1, 2023 · 13 revisions

Setup

  1. Download the newest version of pdParticles from the code tab.

  2. Add pdParticles to the root directory of your project.

  3. In your 'main.lua' file add:

import "CoreLibs/graphics"

import "coreLibs/object"

import "pdParticles"

Making a Particle

To create a new particle create a variable using the ParticleCircle class. Also give it an x and y position somewhere on the screen

local p = ParticleCircle(200, 120)

You can modify all of the values with the functions detailed in the classes page.

to make all particles the same size use the setSize function with 1 argument: p:setSize(1)

To make your particles vary in size, still use the setSize function but with 2 arguments to give it a range: p:setSize(15, 25)

The particle mode decides whether the particle will disappear or stay until removed. By using the DECAY particle mode, particles will shrink rapidly until they disappear. p:setMode(Particles.modes.DECAY)

Finally I will set the speed the particles move at. This one can also take in a range. p:setSpeed(3, 7)

Now we can spawn our particle by typing p:add(20) to create 20 particles with those parameters and call p:update every frame to update the particles. If you have multiple systems you can also call Particles:update() instead to update all of them.

This will create an effect that looks something like this:

playdate-20230131-144652

There is a lot more you can do with this library with things like ParticlePolys and ParticleImages (coming eventually) so I hope you have fun messing with this

playdate-20230131-174818

Clone this wiki locally