Hi everyone…
I have a problem, I hope I can get some help.
I have one button (white rect)
I add an event listener to that button.
when I “tap” the first time… I move a green rect somewhere else, or do something
a function that works fine
but then when I “tap” the “second” time I need to make the same button
do something else
here is a piece of code
teclaFa1 = display.newRect( 0, 0, loAnchoDeLaTeclaEs, laAlturaDeLaTeclaBlancaEs ) sceneGroup:insert(teclaFa1) teclaFa1.x = teclaDo.x + loAnchoDeLaTeclaEs \* 3 teclaFa1.y = teclaDo.y teclaFa1:setFillColor( 1, 1, 1 ) teclaFa1.strokeWidth = 1 teclaFa1:setStrokeColor( 0, 0, 0 ) teclaFa1.isVisible = true local function tocaFa1() if isBeat1 == true and isCorrectFa1 == true and pmViditas \>= 1 and isMoving == false then locator.x = notaFa2.x moveBoat() isBeat1 = false isBeat2 = true else destroyBoat() end audio.play(playFa) return true end teclaFa1:addEventListener("tap", tocaFa1)
So the first time will move the locator to notaFa2.x
then next time it has to move it to notaFa3.x
and now is the second beat of music
I am just going crazy, trying to figure this out…
I try … if firstTime == true, or something like that, but I just don’t know
how to make the same button to understand
when I tap it for the first time, or the second time, or the third…
I hope I make sense and you can help me with this
Victor
As always I really appreciate your time in helping me out…