I have 2 variables : wave and zombies.
The value of zombies is equal to the value of waves.
I also have a button which when you tap on it, the number of zombies will decrease by 1 and then printed it in the console.
However when I click on the button, the value of zombies is decreased by 1 but on the display, the text doesnt change.
How can I make the text update when the value of zombies has changed?
Here is my code:
local wave = 1 local zombies = wave local function lowerzombies() zombies=zombies-1 print(zombies) end local circle = display.newCircle(display.contentCenterX,display.contentCenterY+70,40) circle:addEventListener("tap",lowerzombies) local waveText = display.newText(wave, display.contentCenterX, 100, native.systemFontBold, 25) local waveTitle = display.newText("Wave:", waveText.x, waveText.y-20, native.systemFontBold, 25) local zombiesText = display.newText(zombies, display.contentCenterX, 175, native.systemFontBold, 25) local zombiesTitle = display.newText("Zombies:", zombiesText.x, zombiesText.y-20, native.systemFontBold, 20)