I just implemented CBEffects and it looks great! I’m having trouble figuring out how to create a power-up effect where particles start at the edge of a circle and move in to the center. I’ve been playing around with using inner and outer radius to spawn the effects in a circle, but I can’t get them to all move towards the center point. Can this be done with CBEffects’ settings?
Anything can be done with CBEffects’ settings
There is no built-in parameter for that, but you can easily do that with an onCreation function:
[lua]
local vent = CBE.newVent({
positionType = “inRadius”,
radius = 500,
innerRadius = 400,
onCreation = function(particle, vent)
particle:setVelocity((vent.x - particle.x) * 0.01, (vent.y - particle.y) * 0.01) – Set the velocity based on the vent’s position vs. particle’s position
end,
physics = {
gravityY = 0, – Make sure you’ve got no outside forces
velocity = 0
}
})
vent:start()
[/lua]
[Edit:] Sorry, the forum code formatting messed up on me
- C
Perfect! This is exactly what I was looking for. Thank you for creating and supporting this particle engine, it has definitely saved me quite a bit of time!
Anything can be done with CBEffects’ settings
There is no built-in parameter for that, but you can easily do that with an onCreation function:
[lua]
local vent = CBE.newVent({
positionType = “inRadius”,
radius = 500,
innerRadius = 400,
onCreation = function(particle, vent)
particle:setVelocity((vent.x - particle.x) * 0.01, (vent.y - particle.y) * 0.01) – Set the velocity based on the vent’s position vs. particle’s position
end,
physics = {
gravityY = 0, – Make sure you’ve got no outside forces
velocity = 0
}
})
vent:start()
[/lua]
[Edit:] Sorry, the forum code formatting messed up on me
- C
Perfect! This is exactly what I was looking for. Thank you for creating and supporting this particle engine, it has definitely saved me quite a bit of time!