Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lives = 5
- local lifeIcons={}
- local maxLives = 5
- local i
- local function health(currentLives)
- for i = 1, currentLives do
- if lifeIcons[i] then
- lifeIcons[i].isVisible = true
- else
- lifeIcons[i] = display.newImage("heart.png")
- lifeIcons[i].x = 10 + (lifeIcons[i].contentWidth * (i - 1))
- lifeIcons[i].y = 30 -- start at 10,10
- end
- end
- for i = currentLives + 1, #lifeIcons do
- lifeIcons[i].isVisible = false
- end
- end
- health(maxLives)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement