1 Reply Latest reply on Apr 19, 2006 12:37 PM by Newsgroup_User

    I need help guys....

    NismoBrothers
      Hey guys... i have this script right now that can makes letters light up in a field when typed on the keyboard but it has some problems that I need help to change.... First of all my objective is to make a typing game.... Like all typing games you are supposed to type the letters according from left to right..... I want this script altered so that you must only type from left to right... this script also has a problem that for example when like the world "property", when the letter P is typed both the P words light up... please help me alter this so that it suites my needs

      property myWord, mySprite

      on beginSprite me
      myWord = []
      mySprite = sprite(1)
      t = mySprite.member.text
      repeat with cnt = 1 to t.length
      myWord.add(t.char[cnt])
      end repeat
      mySprite.member.color = color(255,255,255)
      end

      on keyDown me
      inds = []
      repeat with cnt = 1 to myWord.count
      if myWord[cnt] = _key.key then
      inds.add(cnt)
      end if
      end repeat
      repeat with cnt = 1 to inds.count
      mySprite.member.char[inds[cnt]].color = color(255,0,0)
      end repeat
      end
        • 1. Re: I need help guys....
          Level 7
          I don't under what your 'Left To Right' criteria is in reference, are
          you thinking of only responding if one types the next uncolored lette in
          the sequence.


          As far as having multiple letters hilite at once.


          on keyDown me
          inds = [] --?
          repeat with cnt = 1 to myWord.count
          if myWord = _key.key then
          inds.add(cnt)
          exit repeat --*** add this to bail after first letter hilite ***
          end if
          end repeat
          repeat with cnt = 1 to inds.count
          mySprite.member.char[cnt].color = color(255,0,0) -- char[cnt] ?
          end repeat
          end



          You might also have to add a test if the found letter has already been
          colored