I already have player lives dealt with, now I am trying to display the current number of enemies via a table of images (numbers) and have it updating the image to correspond with the current value of ‘EnemyCount’.
I have been reading this article and trying to reverse-engineer it , but with no luck: http://omnigeek.robmiracle.com/2011/05/30/implementing-a-health-status-bar-in-corona-sdk/
I have a variable specifying how many enemies are in the current level EnemyCount = 3 for example, and whenever an enemy is destroyed I have it decreasing the value EnemyCount = EnemyCount - 1
This is as far as I got:
[lua]
local numberTable =
{
“GUI_assets/num_1.png”,
“GUI_assets/num_2.png”,
“GUI_assets/num_3.png”,
“GUI_assets/num_0.png”,
}
local numberIndex
function updateECN()
numberIndex = EnemyCount
print(numberIndex)
current_EC = display.newImage(numberTable[numberIndex])
current_EC.x = 900
current_EC.y = 30
end
Runtime:addEventListener(“enterFrame”, updateECN)
[/lua]
It changes the number, but the previous image is still being displayed.
Idk why, but I can’t think of the logic behind this seemingly simple concept.
Anyone have a suggestion?
-Saer
(Forgive the poor line-spacing. I used the [l u a] text format option instead of the blue arrow things )