My attempt so far is using “if” statements. My problem is that I make one “if” statement valid in the previous “if” statement. Is there a way to have the function stop after reading the end of the first “if” statement?
I commented in a example of what I’m trying to do in my sample code. Are there also “or” statements I should be familiar with?
Just to sum it up differently,
I included asterisks on two of the “if” statements. I would like for the function only go through with one of the two. This may be relatively simple but I’m honestly at a loss.
Thanks for any help!
[lua]
fromBox1 == false
local function boxListener (event)
if (event.phase == “began”) then
*if (fromBox1 == false) then
fromBox1 = true
box1GreenButton = display.newImageRect (“greenBall.png”, 20, 20 )
box1GreenButton.x = display.contentWidth/2.46
box1GreenButton.y = display.contentHeight/2.45
print (“1”)
–Example: stop boxListener Function here so that it doesn’t go on to read the next “if” statement.
end
*if (fromBox1 == true) then
print (“1b”)
fromBox1 = false
deleteFunction (box1GreenButton)
end
end
end[/lua] [import]uid: 35535 topic_id: 32059 reply_id: 332059[/import]