So I am using Dusk and CBE and I use CBE’s newVent as a death animation to all enemies.
I noticed that if the death animation is used when played and player dies comes error, BUT if I complete the level and death animation has happened NO error occurs. Odd thing is that when you die/complete level the scene just reloads using composer.gotoScene(“game”). So same scene removal happens on both events.
Here is the error:
[lua]
CBE\cbe_core\vent_core\core.lua:293: attempt to call method ‘insert’ (a nil value)
message
stack traceback:
?: in function <?:221>
[C]: in function ‘insert’
CBE\cbe_core\vent_core\core.lua:293: in function ‘_listener’
?: in function <?:167>
?: in function <?:221>
[/lua]
And this is my deathAnimation function:
[lua]
L.deathAnim = function(x,y)
local CBE = require(“CBE.CBE”)
local vent = CBE.newVent({
preset = “flame”,
positionType = “inRadius”,
color = {{0.1, 0.1, 0.1}, {0.2}, {0.3, 0.3, 0.3}},
A vent acts as a sort of particle bank. Each time you call :start(), it emits a certain number of particles for a certain amount of time. This means you have to destroy them at some point just as with most display objects:
vent:destroy()
You should destroy the vent before changing scenes.
How can I use the same vent and emit particles in multiple coordinates…? My deathAnim function now makes everytime a new vent. In this approach I need to use array for the vents to destroy them in loop before scene changes…
How can I use the same vent and emit particles in multiple coordinates..?
Just set the vent’s emitX and emitY properties to reposition the vent, then :start() it. If you need multiple of the same effect, a technique which has worked for me is to create two vents and use them in a round-robin fashion. You can expand this concept for three vents, four, etc., depending on how many effects you need at the same time.
A vent acts as a sort of particle bank. Each time you call :start(), it emits a certain number of particles for a certain amount of time. This means you have to destroy them at some point just as with most display objects:
vent:destroy()
You should destroy the vent before changing scenes.
How can I use the same vent and emit particles in multiple coordinates…? My deathAnim function now makes everytime a new vent. In this approach I need to use array for the vents to destroy them in loop before scene changes…
How can I use the same vent and emit particles in multiple coordinates..?
Just set the vent’s emitX and emitY properties to reposition the vent, then :start() it. If you need multiple of the same effect, a technique which has worked for me is to create two vents and use them in a round-robin fashion. You can expand this concept for three vents, four, etc., depending on how many effects you need at the same time.