0
local heli = display.newCircle(x_pos, y_pos, radius)
local y_direction = 1
local y_speed = 5
local function animate(event)
y_pos = y_pos + (y_direction * y_speed);
if(y_pos > screen_bottom - radius) then
y_direction = y_direction * -1;
heli.fill = green_paint;
end
if(y_pos < screen_top + radius) then
y_direction = y_direction * -1;
heli.fill = red_paint;
end
heli:translate(x_pos - heli.x, y_pos - heli.y)
end
local function touchpop(self, event)
if(event.phase == "began") then
self:removeSelf()
end
return true
end
Runtime:addEventListener("enterFrame", animate);
heli.onTouch = touchpop
heli:addEventListener("touchpop", heli)
Я пытаюсь удалить объект heli
, когда он будет затронут. Но это не исчезает, когда я прикасаюсь к нему. Как убедиться, что затронутый объект исчезает?Удаление движущегося объекта в Короне