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?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Spawn image after its been removed question? HELP PLEASE
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.
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?
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??
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
Function values
Alternative / homage to Director (early code included) = maybe of interest?
Updating variable on click
Formula/method for "predicted" 2D parabola path?
Happy Doodle Sushi Smile - FINALLY approved!
Hamster Vice Comic Book now in App Store
Punch bag style joint
Ghosts VS Monsters aka Angry Ghosts - Angry Birds Sample Game is Open Source
Server Login Problem during Build --- Time is 10:44PM PST