Hi All,
I’m working on my second app and I’m trying to create efficient code so I’m using modules and tables. In this project I have students clicking on directional arrows to make a robot go through a course, then when the robot finishes the course, they press the “clear” button to remove all of the stored robot movements. (as they click the directional arrows, a visual representation of what they have clicked appears on the screen). Everything is working fine except the removal of the images that show what they have clicked. To show the initial images I am doing:
function turnImages()
if
introduction.turn1 == "forward" then
firstImage = display.newImage(imageTable[1])
firstImage.x= 50; firstImage.y = 30
else if introduction.turn1 == "right" then
firstImage = display.newImage(imageTable[2])
firstImage.x= 50; firstImage.y = 30
else if introduction.turn1 == "backward" then
firstImage = display.newImage(imageTable[3])
firstImage.x= 50; firstImage.y = 30
else if introduction.turn1 == "left" then
firstImage.x= 0; firstImage.y = 0 else if
introduction.turn1 == nil then
firstImage = display.newImage(imageTable[5])
end
end
end
end
end
and I have tried several methods to remove such as firstImage:removeSelf(), imageTable = {}, and the fifth image is just an invisible square (thinking I could replace the first choice with this) but nothing seems to work.
Can someone point me toward the correct method?
Thanks [import]uid: 48122 topic_id: 19470 reply_id: 319470[/import]