home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Train.dxr / Internal_12.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.8 KB  |  141 lines

  1. global gcurrsprites, gwords, carm, wordtest, gtot
  2.  
  3. on checkKey
  4.   if gcurrsprites.count > 0 then
  5.     gcurrsprites = sortlist(gcurrsprites.duplicate())
  6.     if checksp(gcurrsprites) then
  7.       repeat with i in gcurrsprites
  8.         sprite(i).pActive = 0
  9.         sprite(i).member = sprite(i).pfound
  10.       end repeat
  11.       lineto = getline(gcurrsprites)
  12.       member("word list").line[lineto].color = rgb(153, 153, 204)
  13.       gwords.deleteAt(1)
  14.       member("words left").text = string(0 + gwords.count) & "/" & string(gtot) && "Words left"
  15.       repeat with r in gcurrsprites
  16.         repeat with t = 1 to wordtest.count
  17.           if wordtest[t] = gcurrsprites then
  18.             next repeat
  19.           end if
  20.           repeat with dd = 1 to wordtest[t].count
  21.             if wordtest[t][dd] = r then
  22.               wordtest[t].deleteAt(dd)
  23.               if wordtest[t].count = 0 then
  24.                 gwords.deleteAt(1)
  25.                 lineto = getline(wordtest[t])
  26.                 member("word list").line[lineto].color = rgb(153, 153, 204)
  27.               end if
  28.             end if
  29.           end repeat
  30.         end repeat
  31.       end repeat
  32.       gcurrsprites.deleteAll()
  33.     else
  34.       repeat with i in gcurrsprites
  35.         sprite(i).member = sprite(i).pnorm
  36.         sprite(i).pActive = 1
  37.       end repeat
  38.       gcurrsprites.deleteAll()
  39.       puppetSound(4, "incorrect")
  40.     end if
  41.   end if
  42.   if gwords.count = 0 then
  43.     gameEnd()
  44.   end if
  45. end
  46.  
  47. on gameEnd
  48.   s = the ticks + 35
  49.   repeat while the ticks < s
  50.     updateStage()
  51.   end repeat
  52.   go("game over")
  53. end
  54.  
  55. on getline asd
  56.   repeat with i = 1 to wordtest.count
  57.     if asd = wordtest[i] then
  58.       xt = getu(wordtest.getPropAt(i))
  59.       put xt && "XT"
  60.       return xt
  61.     end if
  62.   end repeat
  63. end
  64.  
  65. on getu arg
  66.   case arg of
  67.     #aerotrain:
  68.       return 1
  69.     #bigboy:
  70.       return 2
  71.     #blucher:
  72.       return 3
  73.     #bullettrain:
  74.       return 4
  75.     #canadian:
  76.       return 5
  77.     #cannonball:
  78.       return 6
  79.     #capitole:
  80.       return 7
  81.     #chief:
  82.       return 8
  83.     #coastdaylight:
  84.       return 9
  85.     #colonial:
  86.       return 10
  87.     #consolidation:
  88.       return 11
  89.     #coyotespecial:
  90.       return 12
  91.     #cubanspecial:
  92.       return 13
  93.     #dewittclinton:
  94.       return 14
  95.     #diplomat:
  96.       return 15
  97.     #dixieflyer:
  98.       return 16
  99.     #elcapitan:
  100.       return 17
  101.     #fastmail:
  102.       return 18
  103.     #leshuttle:
  104.       return 19
  105.     #mikado:
  106.       return 20
  107.     #mistral:
  108.       return 21
  109.     #mogul:
  110.       return 22
  111.     #nightowl:
  112.       return 23
  113.   end case
  114. end
  115.  
  116. on sortlist aList
  117.   temp1 = []
  118.   repeat with i in aList
  119.     temp1.add(i)
  120.   end repeat
  121.   temp1.sort()
  122.   return temp1
  123. end
  124.  
  125. on checksp ali
  126.   repeat with i = 1 to wordtest.count
  127.     if ali = wordtest[i] then
  128.       return 1
  129.     end if
  130.   end repeat
  131.   return 0
  132. end
  133.  
  134. on getp ali
  135.   repeat with i = 1 to wordtest.count
  136.     if ali = wordtest[i] then
  137.       return wordtest.getPropAt(i)
  138.     end if
  139.   end repeat
  140. end
  141.