I’m making an app where you have multiple levels and i am doing a Listener for each level but I think it is not a method very efficient, becasue I repeat the same function for each level, varying only in the numbering. Here attached a part. any suggestions?
function startGame(event)
menuPrincipal.grupo.alpha=0
niveles.grupo.alpha=0
core1.grupoAlerta.alpha=0
core1.grupo.alpha=1
return true
end
function startGame2(event)
menuPrincipal.grupo.alpha=0
niveles.grupo.alpha=0
core2.grupoAlerta.alpha=0
core2.grupo.alpha=1
return true
end
function startGame3(event)
menuPrincipal.grupo.alpha=0
niveles.grupo.alpha=0
core3.grupoAlerta.alpha=0
core3.grupo.alpha=1
return true
end
function startGame4(event)
menuPrincipal.grupo.alpha=0
niveles.grupo.alpha=0
core4.grupoAlerta.alpha = 0
core4.grupo.alpha = 1
return true
end
niveles.nivel1:addEventListener(“tap”,startGame)
niveles.nivel2:addEventListener(“tap”,startGame2)
niveles.nivel3:addEventListener(“tap”,startGame3)
niveles.nivel4:addEventListener(“tap”,startGame4) [import]uid: 180288 topic_id: 35083 reply_id: 335083[/import]
