home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / ingenius / shockwav / quest.dcr / 00007_text.ls < prev    next >
Encoding:
Text File  |  1996-05-10  |  4.6 KB  |  188 lines

  1. on exitFrame
  2.   global guyX, guyY, olds, guyXX, guyYY, pillarname, wordList, posGN
  3.   set s to olds
  4.   set guyXX to 0
  5.   set guyYY to 0
  6.   repeat with y = -1 to 1
  7.     repeat with x = -1 to 1
  8.       set yy to guyY + y
  9.       set xx to guyX + x
  10.       if (xx < 1) or (xx > 5) or (yy < 1) or (yy > 7) then
  11.         next repeat
  12.       end if
  13.       set ss to 44 - (yy * 5) - xx
  14.       if rollOver(ss) then
  15.         set s to ss
  16.         set posGN to word 1 of the name of cast the castNum of sprite 41 && getAt(["left", "forward", "right"], x + 2)
  17.         set realY to y + 1
  18.         set y to 1
  19.         exit repeat
  20.       end if
  21.       set s to 0
  22.     end repeat
  23.   end repeat
  24.   if s then
  25.     set text to getWord(xx, yy)
  26.     if text = EMPTY then
  27.       set text to " "
  28.     end if
  29.     if text = EMPTY then
  30.       set text2 to " "
  31.     end if
  32.     put text into field "Text"
  33.     put text into field "Text2"
  34.     puppetSprite(48, 1)
  35.     set the locH of sprite 48 to the mouseH - 123
  36.     set the locV of sprite 48 to the mouseV - 22
  37.     set guyXX to xx
  38.     set guyYY to yy
  39.     set oneSetAlready to s
  40.   end if
  41.   set curs to the number of cast ("cursor" && string(x) && string(realY))
  42.   if curs > 0 then
  43.     cursor([curs])
  44.   else
  45.     cursor([the number of cast "cursor 0"])
  46.   end if
  47.   if s <> olds then
  48.     set olds to s
  49.   end if
  50.   if not s then
  51.     put " " into field "Text"
  52.     put " " into field "Text2"
  53.   end if
  54.   ruby()
  55.   set t1 to the ticks
  56.   go(the frame)
  57. end
  58.  
  59. on mouseDown
  60.   global guyX, guyY, guyXX, guyYY, checkList, posGN
  61.   puppetSprite(48, 0)
  62.   updateStage()
  63.   put " " into field "text2"
  64.   cursor(0)
  65.   if (guyX = guyXX) and (guyY = guyYY) then
  66.     exit
  67.   end if
  68.   if not guyXX or not guyYY then
  69.     exit
  70.   end if
  71.   set text to getWord(guyXX, guyYY)
  72.   if text = EMPTY then
  73.     set text to " "
  74.   end if
  75.   if text <> field "text" then
  76.     put text into field "Text"
  77.   end if
  78.   if text <> field "text2" then
  79.     put text into field "Text2"
  80.   end if
  81.   if getCheck(guyXX, guyYY) then
  82.     cursor(4)
  83.     updateStage()
  84.     goodJump()
  85.     if guyY = 7 then
  86.       set guyYY to guyY + 1
  87.       goodJump()
  88.       wonit()
  89.     end if
  90.   else
  91.     badJump()
  92.   end if
  93.   set guyXX to 0
  94.   set guyYY to 0
  95. end
  96.  
  97. on goodJump
  98.   global guyX, guyY, guyXX, guyYY, posGN
  99.   set d to 2
  100.   set dd to 1 / float(d)
  101.   set cnum to the castNum of sprite 41
  102.   set name to the name of cast cnum
  103.   set the castNum of sprite 41 to the number of cast (word 1 of name && "takeoff")
  104.   if word 1 of the name of cast the castNum of sprite 41 = "guy" then
  105.     puppetSound("Grunt.wav")
  106.   else
  107.     puppetSound("Jengrunt.wav")
  108.   end if
  109.   updateStage()
  110.   repeat with i = 0 to d
  111.     set x to float(((guyXX - guyX) * i * dd) + guyX)
  112.     set y to float(((guyYY - guyY) * i * dd) + guyY)
  113.     if i < d then
  114.       set the castNum of sprite 41 to the number of cast (name && "jump")
  115.     else
  116.       set the castNum of sprite 41 to the number of cast (word 1 of name && "land")
  117.     end if
  118.     placeguy(x, y)
  119.     updateStage()
  120.   end repeat
  121.   set guyX to guyXX
  122.   set guyY to guyYY
  123.   placeguy(guyX, guyY)
  124.   puppetSound("Thump.wav")
  125.   updateStage()
  126.   set t to the ticks
  127.   repeat while the ticks < (t + 1)
  128.   end repeat
  129.   set the castNum of sprite 41 to cnum
  130.   placeguy(guyX, guyY)
  131.   repeat while soundBusy(1)
  132.   end repeat
  133.   puppetSound(0)
  134. end
  135.  
  136. on badJump
  137.   global guyX, guyY, guyXX, guyYY, olds
  138.   goodJump()
  139.   set s to 44 - (guyY * 5) - guyX
  140.   puppetSound(0)
  141.   puppetSound("Crumble.wav")
  142.   puppetTransition(28, 1, 4, 1)
  143.   set saveS to the castNum of sprite s
  144.   set cast41 to the castNum of sprite 41
  145.   set ink41 to the ink of sprite 41
  146.   set forecolor41 to the foreColor of sprite 41
  147.   set backcolor41 to the backColor of sprite 41
  148.   set rect41 to the rect of sprite 41
  149.   set the castNum of sprite s to 0
  150.   updateStage()
  151.   puppetTransition(0)
  152.   repeat while soundBusy(1)
  153.   end repeat
  154.   puppetSound(0)
  155.   if word 1 of the name of cast the castNum of sprite 41 = "guy" then
  156.     puppetSound("fall.wav")
  157.   else
  158.     puppetSound("Jenfall.wav")
  159.   end if
  160.   set olds to 0
  161.   set name to the name of cast the castNum of sprite 41
  162.   set the castNum of sprite 41 to 0
  163.   set the castNum of sprite s to the number of cast (word 1 of name && "fall")
  164.   set the ink of sprite s to ink41
  165.   set the foreColor of sprite s to forecolor41
  166.   set the backColor of sprite s to backcolor41
  167.   set the rect of sprite s to rect41
  168.   set v to the locV of sprite s
  169.   repeat with i = 1 to 13
  170.     set the locV of sprite s to v + (i * 30)
  171.     updateStage()
  172.   end repeat
  173.   set the castNum of sprite s to saveS
  174.   set the castNum of sprite 41 to cast41
  175.   set the locV of sprite 41 to 2000
  176.   go("lost")
  177. end
  178.  
  179. on wonit
  180.   wintest()
  181. end
  182.  
  183. on wait w
  184.   set t to the ticks
  185.   repeat while the ticks < (t + w)
  186.   end repeat
  187. end
  188.