Hi everyone…
I have this function and it works fine.
local function findingNotes() local notesPictures = {"images/quarterNoteUp.png","images/wholeNote.png", "images/trebleClef.png"} local notes = display.newImage(notesPictures[math.random (#notesPictures)]) notes.x = 400; notes.y = 700 return true end
I press a button and I get a random note image, so every time I re-launch the app I get a new note, it’s great!
The problem is, when I press the button again, the first image doesn’t remove itself. so now I have 2 images
or 3 or four.
I tried this
local function buttonGameHandler() notes = nil; local notesPictures = {"images/quarterNoteUp.png","images/wholeNote.png", "images/trebleClef.png"} local notes = display.newImage(notesPictures[math.random (#notesPictures)]) notes.x = 400; notes.y = 700 return true end
and it did note work –
I tried this one too
local function buttonGameHandler() display.remove(notes) local notesPictures = {"images/quarterNoteUp.png","images/wholeNote.png", "images/trebleClef.png"} local notes = display.newImage(notesPictures[math.random (#notesPictures)]) notes.x = 400; notes.y = 700 return true end
And didn’t work…
I’m trying to use the logic, but I don’t get it.
Please I need some help
Thanks