I’ve seemed to run into a problem, I have multiple enemies being spawned with the perform with delay call. But when i kill one of the enemies they all stop moving! Which is not what i’m trying to achieve! Any help would be appreciated
The Code –
[code]
local function dino()
local health = 100;
local dinos = display.newCircle(0,0,10);
dinos.x = -47;
dinos.y = waypointsY[rnd(1, #waypointsY)];
local healthBar = display.newRect(0,0,100,5);
healthBar.x = dinos.x
healthBar.y = dinos.y - 30
healthBar:setFillColor(255,0,0);
healthBar.isVisible = false;
local function tapGone(e)
if(e.phase == “began”) then
healthBar.isVisible = true;
health = health - 20;
healthBar.xScale = health / 90;
end
if(e.phase == “ended”)then
healthBar.isVisible = false;
end
if(health == 0) then
healthBar:removeSelf();
dinos:removeSelf();
end
end – end TapGone
local function move(e)
dinos.x = dinos.x + 2;
healthBar.x = healthBar.x + 2;
end – end Move
– Listeners
dinos:addEventListener(“touch”, tapGone);
Runtime:addEventListener(“enterFrame”, move);
– End Listeners
end – end function
timer.performWithDelay(300, dino, 23);
[/code] [import]uid: 56659 topic_id: 12611 reply_id: 312611[/import]
