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}},
particleProperties = {blendMode = “add”},
emitX = x,
emitY = y,
emissionNum = 1,
emitDelay = 0,
perEmit = 3,
inTime = 100,
lifeTime = 100,
outTime = 600,
physics = {
velocity = 0,
gravityY = 0,
angles = {0, 360},
},
onCreation = function(particle)
particle:changeColor({
--color = {0, 1, 0},
--time = 600
})
end,
})
local map = (require “map”).layer[“ground”]
map:insert(vent)
vent:start()
map=nil
end
[/lua]