My game is a pixel art game, and so almost all my pSystems use single-pixel sprites with the different colors in my palette. It feels wasteful and unnecessary to create a new particle system, with a new single-pixel asset, for every color variation when they have the exact same dimensions. I'm hoping there's a more elegant way to do it.
Here is my code:
Code: Select all
function spawnBulletParticles(pSys, numOfParticles, isDamageUp)
local direction = player_angle() - math.pi/2 - math.pi/8
local increment = math.pi/4 / numOfParticles
if isDamageUp then
print('damage is increased')
pSys:setColors(rgb(183), rgb(231), rgb(246), 1)
end
for i = 1, numOfParticles do
pSys:setDirection(direction)
pSys:emit(1)
direction = direction + increment
end
end
The sprite for this pSystem is blue, and I'm trying to change it to red while a damage powerup is active. Print statement confirms that :setColors is running and I'm not getting errors, but the emitted particles remain blue. Is there a way achieve what I'm looking for? And what is the expected functionality of :setColors?