Highlight letter images on touch

Hi guys, I just want to ask how or what do to highlight objects just like the image below when moving touch. TIA :slight_smile:

You need to provide more information. Have you got the wordsearch up and running up to this point? What does the code look like?

Yes, I already be able to detect letters through touch

here is the code for the touch

function touchMe(event)

  if ( event.phase == “began” ) then

        initX = event.target.x

        initY = event.target.y

        prevValue = event.target.value

        assembledWord = assembledWord … prevValue

        assembleWord( assembledWord )

        alphabet[event.target.id].alreadytouched = true

        alphabet[event.target.idj].alreadytouchedj = true

  elseif (event.phase == “moved”) then

        print(event.x)

        print(event.y)

        if (alphabet[event.target.id].alreadytouched == false or alphabet[event.target.idj].alreadytouchedj == false ) then

            for i = 1, feedBackLines.numChildren do

            feedBackLines:remove(i)

            end

            line = display.newLine(initX, initY, event.target.x, event.target.y)

            line.strokeWidth = 20

            line:setStrokeColor(0, 0, 0)

            line.alpha = 0.5

            feedBackLines:insert(line)

            

      

          alphabet[event.target.id].alreadytouched = true

          alphabet[event.target.idj].alreadytouchedj = true

          assembledWord = assembledWord…event.target.value

          assembleWord(assembledWord)

          print(assembledWord)

          print(event.target.id)

        end

  elseif( event.phase == “ended”) then

        alphabet[event.target.id].alreadytouched = false

        alphabet[event.target.idj].alreadytouchedj = false

         event.target.alpha = 1

         for j = 0, 6 do

            if(assembledWord == L1[j]) then

            wordsList[j]:setTextColor(238, 238, 238,0.5)

            print(“CORRECT!”)

            newline = display.newLine(initX, initY, event.target.x, event.target.y)

            newline.strokeWidth = 20

            newline:setStrokeColor(0, 1, 0)

          

            lines:insert(newline)

            end

          end

  end

end

You need to provide more information. Have you got the wordsearch up and running up to this point? What does the code look like?

Yes, I already be able to detect letters through touch

here is the code for the touch

function touchMe(event)

  if ( event.phase == “began” ) then

        initX = event.target.x

        initY = event.target.y

        prevValue = event.target.value

        assembledWord = assembledWord … prevValue

        assembleWord( assembledWord )

        alphabet[event.target.id].alreadytouched = true

        alphabet[event.target.idj].alreadytouchedj = true

  elseif (event.phase == “moved”) then

        print(event.x)

        print(event.y)

        if (alphabet[event.target.id].alreadytouched == false or alphabet[event.target.idj].alreadytouchedj == false ) then

            for i = 1, feedBackLines.numChildren do

            feedBackLines:remove(i)

            end

            line = display.newLine(initX, initY, event.target.x, event.target.y)

            line.strokeWidth = 20

            line:setStrokeColor(0, 0, 0)

            line.alpha = 0.5

            feedBackLines:insert(line)

            

      

          alphabet[event.target.id].alreadytouched = true

          alphabet[event.target.idj].alreadytouchedj = true

          assembledWord = assembledWord…event.target.value

          assembleWord(assembledWord)

          print(assembledWord)

          print(event.target.id)

        end

  elseif( event.phase == “ended”) then

        alphabet[event.target.id].alreadytouched = false

        alphabet[event.target.idj].alreadytouchedj = false

         event.target.alpha = 1

         for j = 0, 6 do

            if(assembledWord == L1[j]) then

            wordsList[j]:setTextColor(238, 238, 238,0.5)

            print(“CORRECT!”)

            newline = display.newLine(initX, initY, event.target.x, event.target.y)

            newline.strokeWidth = 20

            newline:setStrokeColor(0, 1, 0)

          

            lines:insert(newline)

            end

          end

  end

end