Heres the scene code, its a basic word find game.
local storyboard = require ( "storyboard" ) local scene = storyboard.newScene() local screenGroup = display.newGroup() local tfs = display.newGroup() local lines = display.newGroup() local line local bell = audio.loadStream('corect.wav') local click = audio.loadStream('click.wav') local ding = audio.loadStream('ding.wav') local L1 = {"DOG"} local L1Map = {{}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, "D", "O", "G"}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} local alphabet = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} local correct = 0 local wordsList; local clueText; local gameBg; local lvlnumber; local lvlText; local menubutton; local menuText; local token; local answerText; local function hitTestObjects(obj1, obj2) local left = obj1.contentBounds.xMin \<= obj2.contentBounds.xMin and obj1.contentBounds.xMax \>= obj2.contentBounds.xMin local right = obj1.contentBounds.xMin \>= obj2.contentBounds.xMin and obj1.contentBounds.xMin \<= obj2.contentBounds.xMax local up = obj1.contentBounds.yMin \<= obj2.contentBounds.yMin and obj1.contentBounds.yMax \>= obj2.contentBounds.yMin local down = obj1.contentBounds.yMin \>= obj2.contentBounds.yMin and obj1.contentBounds.yMin \<= obj2.contentBounds.yMax return (left or right) and (up or down) end local startDraw = function (e) if(e.phase == "began") then initX = e.x initY = e.y elseif(e.phase == "moved") then if line then display.remove(line); line = nil; end line = display.newLine(initX, initY, e.x, e.y) line.width = 16 line:setColor(60, 60, 255, 100) lines:insert(line) elseif(e.phase == "ended") then local selectedWord = "" for i = 1, tfs.numChildren do if(hitTestObjects(lines[lines.numChildren], tfs[i])) then selectedWord = selectedWord .. tfs[i].text end end -- Check if word is on list for j = 0, 5 do if(selectedWord == L1[j]) then audio.play(bell) currentWords.text = currentWords.text .. " " .. selectedWord currentWords:setReferencePoint(display.TopLeftReferencePoint) currentWords.x = 5 correct = correct + 1 end end print (CORRECT) if(correct == #L1) then --alert() print ("CORRECT "..#L1) line.isVisible = false storyboard.gotoScene( "scene2", "slideLeft", 750) storyboard.removeScene( "scene1" ) end end end local function gameListeners(action) if(action == "add") then gameBg:addEventListener("touch", startDraw) --gameBg:addEventListener("touch", detectLetters) else gameBg:removeEventListener("touch", startDraw) --gameBg:removeEventListener("touch", detectLetters) end end local function alert() gameListeners("rm") -- -- alert = display.newImage("alert.png") -- --alert:addEventListener("tap", restart) or next level! end function scene:createScene(event) screenGroup = self.view local createHud = function () gameBg = display.newImage("titleBg3.png") gameBg.x = display.contentWidth / 2 gameBg.y = display.contentHeight / 2 lvlnumber = display.newImage("lvlnumber1.png", 0, -6) menubutton = display.newImage("menubutton5.png", -10, -4) token = display.newImage("token1.png", 205, 0) screenGroup:insert(gameBg) screenGroup:insert(lvlnumber) screenGroup:insert(menubutton) screenGroup:insert(token) clueText = display.newText( " Dog ", 0, 450, "Arial", 16) clueText:setTextColor(255, 255, 255) clueText.x = 160 screenGroup:insert(clueText) lvlText = display.newText ( "1", 0, 20, "Arial", 16) lvlText:setTextColor(255, 255, 255) lvlText.x = 157 screenGroup:insert(lvlText) menuText = display.newText ( "Menu", 0, 16, "Arial", 16) menuText:setTextColor(255, 255, 255) menuText.x = 53 screenGroup:insert(menuText) answerText = display.newText( " Dog ", 0, 450, "Arial", 16) answerText:setTextColor(255, 255, 255) answerText.x = 160 answerText.isVisible = false screenGroup:insert(answerText) end local buildSoup = function () for i = 1, 10 do for j = 1, 12 do local tf = display.newText("", 0, 0, "Arial", 19) tf:setTextColor(102, 102, 102) --tf.width = 320 --tf.height = 480 tf.x = math.floor(-10 + (31.3 \* i)) tf.y = math.floor(-10 + (35 \* j)) -- Change 0"s to Random Letters if(L1Map[j][i] == 0) then L1Map[j][i] = alphabet[math.floor(math.random() \* table.maxn(alphabet))+1] end tf.text = L1Map[j][i] tfs:insert(tf) end end end local wordsList = function () local wordsString = "" for i = 1, #L1 do wordsString = wordsString .. " " .. L1[i] end wordsList = display.newText(wordsString, 7500, 7500, "Arial", 14) wordsList:setTextColor(238, 238, 238) screenGroup:insert(wordsList) currentWords = display.newText("", 7500, 7500, "Arial", 14) currentWords:setTextColor(238, 146, 63) screenGroup:insert(currentWords) end createHud() buildSoup() wordsList() screenGroup:insert(tfs) end function scene:enterScene(event) local group = self.view function menubutton:touch( event ) if event.phase == "began" then storyboard.gotoScene( "menu", "slideRight", 750 ) audio.play(click) display.getCurrentStage():setFocus( event.target ) event.target.isFocus = true elseif event.target.isFocus then if event.phase == "moved" then print( "user has moved their finger off the button." ) elseif event.phase == "ended" then print( "user has switched to the main menu" ) display.getCurrentStage():setFocus( nil ) event.target.isFocus = false end end return true end function tokenTouch( event ) if event.phase == "began" then if storyboard.state.score \>0 then storyboard.state.score = storyboard.state.score - 1 score.text = tostring(storyboard.state.score) clueText.isVisible = false answerText.isVisible = true audio.play(ding) display.getCurrentStage():setFocus( event.target ) event.target.isFocus = true end elseif event.target.isFocus then if event.phase == "moved" then print( "user has moved their finger off the token." ) elseif event.phase == "ended" then print( "user has used a token" ) display.getCurrentStage():setFocus( nil ) event.target.isFocus = false end end return true end token:addEventListener( "touch", tokenTouch ) menubutton:addEventListener( "touch", menubutton) --function alert() gameListeners("add") --end -- end function scene:exitScene(event) local group = self.view storyboard.destroyScene( "scene1" ) end function scene:destroyScene(event) local group = self.view end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene