Displaying lives issue

i need help with displaying lives with images, can anyone help me out and tell me what i’ve done wrong? thanks
so i have this in the beginning

lives = 3

this is the image i want to be displayed 3 times and make 1 heart be removed when lives are lost

local heart = display.newImage( “heart1.png” )
localGroup:insert(heart)
heart.x = 20
heart.y = 16
lives < 3 remove:Self()

this is the bug code thats supposed to subtract a life once touched, i put lives = lives -1 (this is probably wrong though)

local bug = display.newImage( “scorpion.png” )
localGroup:insert(bug)
bug.x = 600
bug.y = 0
local function moveit (event)
transition.to(bug, {time=7000, x=500, y=100})
local function moveback (event)
transition.to(bug, {time=2000, x=-100, y=300})
end
timer.performWithDelay (5000, moveback, 1)
end

timer.performWithDelay(5000, moveit, 0)
local function killbug (event)
local bloodscreen = display.newImage (“bloodscreen.png”)
transition.to( bloodscreen, { time=500, delay=300, alpha=0 } )
lives = lives - 1
blood.x = bug.x
blood.y = bug.y
bug:removeSelf()
end

bug:addEventListener(“touch”, killbug) [import]uid: 10827 topic_id: 4771 reply_id: 304771[/import]

Whenever you post code you need help fixing you should explain what it is doing wrong so that we can zero in on the problem. If you just say “something is wrong” then we don’t know what to help you with.

In this case though I see a couple issues right off the bat…

First off, “remove:Self()” is not correct syntax. That entire line actually is nonsense, including the conditional at the beginning, so just delete it. I’m surprised Corona wasn’t giving an error message on that line (and if it was, don’t ignore error messages, they’re there for a reason.)

Second, you need to call removeSelf() later when you want to remove the heart. Specifically, right after calling bug:removeSelf() you want to also call heart:removeSelf() [import]uid: 12108 topic_id: 4771 reply_id: 15251[/import]