hey i was wondering, how can i make an image spawn again once its been removed? in my game, i have these bugs running around and once the player touches the bug, it is removed, it wont show up again, is there any way i can make the bug come back after its been removed and start the whole transition all over and over and over and over? [import]uid: 10827 topic_id: 4701 reply_id: 304701[/import]
Could you set its alpha to 0 to make it invisible instead of removing it? You could then set the alpha back to 1 to make it reappear. [import]uid: 8353 topic_id: 4701 reply_id: 15010[/import]
so what you’re saying is, when the player touches the bugs in my game, set the alpha to 0 then back to 1 right? [import]uid: 10827 topic_id: 4701 reply_id: 15168[/import]
so heres one code for my bug image
local bug = display.newImage( “roach.png” )
localGroup:insert(bug)
bug.x = -200
bug.y = 300
local function moveit (event)
transition.to(bug, {time=7000, x=-100, y=160})
local function moveback (event)
transition.to(bug, {time=2000, x=600, y=160})
end
timer.performWithDelay (2000, moveback, 1)
end
timer.performWithDelay(5000, moveit, 0)
local function killbug (event)
local blood = display.newImage (“blood.png”)
transition.to( blood, { time=500, delay=3000, alpha=0 } )
blood.x = bug.x
blood.y = bug.y
score.setScore( score.getScore() + 10)
bug:removeSelf()
end
bug:addEventListener(“touch”, killbug)
how can i make it set the alpha to 0 instead of removing it when the player touches it, then back to 1?? [import]uid: 10827 topic_id: 4701 reply_id: 15169[/import]