home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / rollerrush / game.dcr / Waitress_309_Waitress.ls < prev    next >
Encoding:
Text File  |  2007-10-01  |  24.8 KB  |  960 lines

  1. property sd, spriteNum, currFrame, pAnimating, sFrame, eFrame, pFirstUpdate, skipframe, speed, pDirFacing, pIdleLoop, pMaxSpeed, QueueList, pLeftHand, pRightHand, pWasMovingOnY, pIdleLooped, pLastMoveTime, pDestY, skipMax, pLastDir, pQueueSprites, pLastAction, pLastActionCount, moveToX, moveToY, pAccelRate, pIdling, pIdleSFrame, pIdleEFrame, pCurrIdle, pCurrIdleFrame, pTraySprite1, pTraySprite2, pFlagSprite1, pFlagSprite2, pLastPoint, pTutFed, pDebuggin
  2. global gGameUpgrades, gDoingTutorial, gTutorialStep, gScoreVals
  3.  
  4. on beginSprite me
  5.   sd = sprite(spriteNum)
  6.   pIldeLoop = 0
  7.   speed = 0.0
  8.   pMaxSpeed = 4
  9.   pDestY = 0
  10.   pAnimating = 1
  11.   skipframe = 1
  12.   sFrame = 1
  13.   eFrame = 16
  14.   currFrame = 1
  15.   pAccelRate = 0.29999999999999999
  16.   QueueList = []
  17.   pLeftHand = [#type: EMPTY, #for: 0]
  18.   pRightHand = [#type: EMPTY, #for: 0]
  19.   pDirFacing = 1
  20.   pTutFed = []
  21.   sprite(pTraySprite1).visible = 0
  22.   sprite(pTraySprite2).visible = 0
  23.   sprite(pTraySprite1).locZ = pTraySprite1
  24.   sprite(pTraySprite2).locZ = pTraySprite2
  25.   skipMax = 4
  26.   pLastAction = EMPTY
  27.   pLastActionCount = 0
  28.   pQueueSprites = []
  29.   repeat with b = 410 to 430
  30.     append(pQueueSprites, b)
  31.   end repeat
  32.   pFirstUpdate = 1
  33.   pLastPoint = []
  34.   repeat with b = 325 to 329
  35.     sprite(b).locZ = 110 - (b - 324)
  36.     sprite(b).visible = 0
  37.   end repeat
  38.   pDebuggin = 0
  39. end
  40.  
  41. on StopMoving me
  42.   QueueList = []
  43.   speed = 0.0
  44.   repeat with b = 410 to 430
  45.     sendSprite(b, #turnOff)
  46.   end repeat
  47.   repeat with b = 325 to 329
  48.     sprite(b).locZ = 110 - (b - 324)
  49.     sprite(b).visible = 0
  50.   end repeat
  51. end
  52.  
  53. on DebugMe me
  54.   pDebuggin = 1
  55. end
  56.  
  57. on ScoreThis me, act
  58.   if act = pLastAction then
  59.     pLastActionCount = pLastActionCount + 1
  60.   else
  61.     pLastAction = act
  62.     pLastActionCount = 1
  63.   end if
  64.   act = pLastAction
  65.   if pLastAction = "order" then
  66.     sco = gScoreVals.TakeOrder
  67.   else
  68.     if pLastAction = "food" then
  69.       sco = gScoreVals.GiveFood
  70.     else
  71.       if pLastAction = "check" then
  72.         sco = gScoreVals.GiveCheck
  73.       else
  74.         if pLastAction = "clean" then
  75.           sco = gScoreVals.CleanUp
  76.         else
  77.           if pLastAction = "snack1" then
  78.             sco = gScoreVals.GiveSnack
  79.           else
  80.             if pLastAction = "snack2" then
  81.               sco = gScoreVals.GiveSnack
  82.             end if
  83.           end if
  84.         end if
  85.       end if
  86.     end if
  87.   end if
  88.   DrawScoreText(act, pLastActionCount, sco * pLastActionCount, 0, sd.loc)
  89.   AddToScore(sco * pLastActionCount)
  90. end
  91.  
  92. on update me
  93.   if pFirstUpdate then
  94.     pFirstUpdate = 0
  95.   end if
  96.   if QueueList.count > 0 then
  97.     MoveTo(me, QueueList[1].movePoint, QueueList[1].sprite)
  98.     if QueueList.count = 0 then
  99.       sd.flipH = 0
  100.       AlignObjectToHand(me)
  101.     end if
  102.   else
  103.     if (GetTime() > (pLastMoveTime + 1)) and (pIdling = 0) and (pLeftHand.type = EMPTY) and (pRightHand.type = EMPTY) then
  104.       pIdling = 1
  105.       pDirFacing = 1
  106.       pCurrIdle = 1
  107.       if sd.loc = sprite(675).loc then
  108.         pCurrIdle = 9
  109.       end if
  110.       if pCurrIdle = 1 then
  111.         pIdleSFrame = 193
  112.         pIdleEFrame = 225
  113.         pIdleLoop = 1
  114.         skipMax = 4
  115.       else
  116.         if pCurrIdle = 2 then
  117.           pIdleSFrame = 227
  118.           pIdleEFrame = 243
  119.           pIdleLoop = 1
  120.           skipMax = 4
  121.         else
  122.           if pCurrIdle = 3 then
  123.             pIdleSFrame = 244
  124.             pIdleEFrame = 260
  125.             pIdleLoop = 0
  126.             skipMax = 4
  127.           else
  128.             if pCurrIdle = 4 then
  129.               pIdleSFrame = 261
  130.               pIdleEFrame = 277
  131.               pIdleLoop = 0
  132.               skipMax = 4
  133.             else
  134.               if pCurrIdle = 5 then
  135.                 pIdleSFrame = 278
  136.                 pIdleEFrame = 303
  137.                 pIdleLoop = 0
  138.                 skipMax = 4
  139.               else
  140.                 if pCurrIdle = 6 then
  141.                   pIdleSFrame = 404
  142.                   pIdleEFrame = 431
  143.                   pIdleLoop = 1
  144.                   skipMax = 4
  145.                 else
  146.                   if pCurrIdle = 7 then
  147.                     pIdleSFrame = 432
  148.                     pIdleEFrame = 460
  149.                     pIdleLoop = 0
  150.                     skipMax = 4
  151.                   else
  152.                     if pCurrIdle = 8 then
  153.                       pIdleSFrame = 461
  154.                       pIdleEFrame = 489
  155.                       pIdleLoop = 0
  156.                       skipMax = 4
  157.                     else
  158.                       if pCurrIdle = 9 then
  159.                         pIdleSFrame = 278
  160.                         pIdleEFrame = 287
  161.                         pIdleLoop = 1
  162.                         skipMax = 4
  163.                       end if
  164.                     end if
  165.                   end if
  166.                 end if
  167.               end if
  168.             end if
  169.           end if
  170.         end if
  171.       end if
  172.       pCurrIdleFrame = pIdleSFrame
  173.       sd.flipH = 0
  174.     end if
  175.     pAnimating = 0
  176.   end if
  177.   if pIdling then
  178.     if skipframe >= skipMax then
  179.       skipframe = 1
  180.       sd.memberNum = pCurrIdleFrame
  181.       pCurrIdleFrame = pCurrIdleFrame + 2
  182.       if pCurrIdle < 9 then
  183.         if pCurrIdleFrame > pIdleEFrame then
  184.           if pIdleLoop = 0 then
  185.             pIdling = 0
  186.             pLastMoveTime = GetTime()
  187.           end if
  188.           if pCurrIdle = 1 then
  189.             pIdleSFrame = 199
  190.           end if
  191.           pCurrIdleFrame = pIdleSFrame
  192.         end if
  193.       else
  194.         if (pCurrIdleFrame > pIdleEFrame) and (pIdleEFrame = 287) then
  195.           pIdleSFrame = 362
  196.           pIdleEFrame = 373
  197.           pCurrIdleFrame = 362
  198.           pIdleLooped = 0
  199.         else
  200.           if pCurrIdleFrame > pIdleEFrame then
  201.             pIdleLooped = pIdleLooped + 1
  202.             pCurrIdleFrame = pIdleSFrame
  203.             if pIdleLooped = 3 then
  204.               pIdleLoop = 0
  205.               pIdleSFrame = 373
  206.               pIdleEFrame = 402
  207.               pCurrIdleFrame = 373
  208.             else
  209.               if pIdleLooped = 4 then
  210.                 pIdling = 0
  211.                 pLastMoveTime = GetTime()
  212.               end if
  213.             end if
  214.           end if
  215.         end if
  216.       end if
  217.     else
  218.       skipframe = skipframe + 1
  219.     end if
  220.   end if
  221.   if pAnimating then
  222.     if skipframe >= skipMax then
  223.       skipframe = 1
  224.       currFrame = currFrame + 2
  225.       if currFrame > eFrame then
  226.         currFrame = sFrame
  227.       end if
  228.       sd.flipH = 0
  229.       AlignObjectToHand(me)
  230.     else
  231.       skipframe = skipframe + 1
  232.     end if
  233.   end if
  234. end
  235.  
  236. on AlignObjectToHand me
  237.   global gTrayOffsets
  238.   if (pLeftHand.type = EMPTY) and (pRightHand.type = EMPTY) then
  239.     if pDirFacing = 1 then
  240.       sd.memberNum = currFrame
  241.     else
  242.       if pDirFacing = 2 then
  243.         sd.memberNum = currFrame + 16
  244.       else
  245.         if pDirFacing = 3 then
  246.           sd.memberNum = currFrame + 32
  247.         else
  248.           if pDirFacing = 4 then
  249.             sd.memberNum = currFrame + 16
  250.             sd.flipH = 1
  251.           end if
  252.         end if
  253.       end if
  254.     end if
  255.     return 
  256.   else
  257.     if (pLeftHand.type <> EMPTY) and (pRightHand.type <> EMPTY) then
  258.       sprite(pTraySprite1).locZ = pTraySprite1
  259.       sprite(pTraySprite2).locZ = pTraySprite2
  260.       if pDirFacing = 1 then
  261.         sd.memberNum = currFrame + 48
  262.         sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[1]
  263.         sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[2]
  264.       else
  265.         if pDirFacing = 2 then
  266.           sd.memberNum = currFrame + 16 + 48
  267.           sprite(pTraySprite2).locZ = 109
  268.           sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[3]
  269.           sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[4]
  270.         else
  271.           if pDirFacing = 3 then
  272.             sd.memberNum = currFrame + 32 + 48
  273.             sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[5]
  274.             sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[6]
  275.           else
  276.             if pDirFacing = 4 then
  277.               sd.memberNum = currFrame + 16 + 48
  278.               sd.flipH = 1
  279.               sprite(pTraySprite1).locZ = 109
  280.               sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[7]
  281.               sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[8]
  282.             end if
  283.           end if
  284.         end if
  285.       end if
  286.     else
  287.       if pLeftHand.type <> EMPTY then
  288.         sprite(pTraySprite1).locZ = pTraySprite1
  289.         if pDirFacing = 1 then
  290.           sd.memberNum = currFrame + 96
  291.           sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[1]
  292.         else
  293.           if pDirFacing = 2 then
  294.             sd.memberNum = currFrame + 16 + 96
  295.             sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[3]
  296.           else
  297.             if pDirFacing = 3 then
  298.               sd.memberNum = currFrame + 32 + 96
  299.               sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[5]
  300.             else
  301.               if pDirFacing = 4 then
  302.                 sd.memberNum = currFrame + 16 + 144
  303.                 sd.flipH = 1
  304.                 sprite(pTraySprite1).locZ = 109
  305.                 sprite(pTraySprite1).loc = sd.loc + gTrayOffsets[7]
  306.               end if
  307.             end if
  308.           end if
  309.         end if
  310.       else
  311.         if pRightHand.type <> EMPTY then
  312.           sprite(pTraySprite2).locZ = pTraySprite2
  313.           if pDirFacing = 1 then
  314.             sd.memberNum = currFrame + 144
  315.             sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[2]
  316.           else
  317.             if pDirFacing = 2 then
  318.               sd.memberNum = currFrame + 16 + 144
  319.               sprite(pTraySprite2).locZ = 109
  320.               sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[4]
  321.             else
  322.               if pDirFacing = 3 then
  323.                 sd.memberNum = currFrame + 32 + 144
  324.                 sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[6]
  325.               else
  326.                 if pDirFacing = 4 then
  327.                   sd.memberNum = currFrame + 16 + 96
  328.                   sd.flipH = 1
  329.                   sprite(pTraySprite2).loc = sd.loc + gTrayOffsets[8]
  330.                 end if
  331.               end if
  332.             end if
  333.           end if
  334.         end if
  335.       end if
  336.     end if
  337.   end if
  338.   if pLeftHand.type = "food" then
  339.     sprite(pFlagSprite1).loc = sprite(pTraySprite1).loc + point(5, -5)
  340.     sprite(pFlagSprite1).locZ = sprite(pTraySprite1).locZ
  341.   end if
  342.   if pRightHand.type = "food" then
  343.     sprite(pFlagSprite2).loc = sprite(pTraySprite2).loc + point(5, -5)
  344.     sprite(pFlagSprite2).locZ = sprite(pTraySprite2).locZ
  345.   end if
  346. end
  347.  
  348. on TakeMyOrder me, spr
  349.   fre = 0
  350.   if pLeftHand.type = EMPTY then
  351.     fre = fre + 1
  352.     pLeftHand.type = "order"
  353.     pLeftHand.for = spr
  354.     sendSprite(3, #Flashy)
  355.     ScoreThis(me, "order")
  356.     sprite(pTraySprite1).visible = 1
  357.     sprite(pTraySprite1).memberNum = 341
  358.   else
  359.     if pRightHand.type = EMPTY then
  360.       fre = fre + 1
  361.       pRightHand.type = "order"
  362.       pRightHand.for = spr
  363.       sendSprite(3, #Flashy)
  364.       ScoreThis(me, "order")
  365.       sprite(pTraySprite2).visible = 1
  366.       sprite(pTraySprite2).memberNum = 341
  367.     end if
  368.   end if
  369.   if gDoingTutorial then
  370.     if gTutorialStep = 10 then
  371.       if (pLeftHand.type = "order") and (pRightHand.type = "order") then
  372.         sendSprite(836, #show, 11)
  373.       end if
  374.     end if
  375.   end if
  376.   AlignObjectToHand(me)
  377.   return fre
  378. end
  379.  
  380. on TakeTheFood me, spr, flagNum
  381.   if pLeftHand.type = EMPTY then
  382.     pLeftHand.type = "food"
  383.     pLeftHand.for = spr
  384.     sendSprite(spr, #TurnOnFlag)
  385.     sprite(pFlagSprite1).visible = 1
  386.     sprite(pFlagSprite1).memberNum = flagNum
  387.     sprite(pTraySprite1).visible = 1
  388.     sprite(pTraySprite1).memberNum = 342
  389.   else
  390.     if pRightHand.type = EMPTY then
  391.       pRightHand.type = "food"
  392.       pRightHand.for = spr
  393.       sendSprite(spr, #TurnOnFlag)
  394.       sprite(pFlagSprite2).visible = 1
  395.       sprite(pFlagSprite2).memberNum = flagNum
  396.       sprite(pTraySprite2).visible = 1
  397.       sprite(pTraySprite2).memberNum = 342
  398.     end if
  399.   end if
  400.   AlignObjectToHand(me)
  401. end
  402.  
  403. on TakeDrinks me
  404.   fre = 0
  405.   if pLeftHand.type = EMPTY then
  406.     fre = fre + 1
  407.     pLeftHand.type = "drink"
  408.     pLeftHand.for = 50
  409.     pLastAction = EMPTY
  410.     sendSprite(13, #Take)
  411.     sprite(pTraySprite1).visible = 1
  412.     sprite(pTraySprite1).memberNum = 344
  413.   else
  414.     if pRightHand.type = EMPTY then
  415.       fre = fre + 1
  416.       pRightHand.type = "drink"
  417.       pRightHand.for = 50
  418.       pLastAction = EMPTY
  419.       sendSprite(13, #Take)
  420.       sprite(pTraySprite2).visible = 1
  421.       sprite(pTraySprite2).memberNum = 344
  422.     end if
  423.   end if
  424.   AlignObjectToHand(me)
  425.   return fre
  426. end
  427.  
  428. on TakeMilkShakes me
  429.   fre = 0
  430.   if spriteNum = 115 then
  431.     if (pLeftHand.type <> EMPTY) and (pRightHand.type <> EMPTY) then
  432.       if pLeftHand.type = "icecream" then
  433.         pLeftHand.type = "milkshake"
  434.         sprite(pTraySprite1).memberNum = 345
  435.       else
  436.         if pRightHand.type = "icecream" then
  437.           pRightHand.type = "milkshake"
  438.           sprite(pTraySprite2).memberNum = 345
  439.         end if
  440.       end if
  441.     end if
  442.   end if
  443.   if pLeftHand.type = EMPTY then
  444.     fre = fre + 1
  445.     pLeftHand.type = "milkshake"
  446.     pLeftHand.for = 1
  447.     sprite(pTraySprite1).visible = 1
  448.     sprite(pTraySprite1).memberNum = 345
  449.   else
  450.     if pRightHand.type = EMPTY then
  451.       fre = fre + 1
  452.       pRightHand.type = "milkshake"
  453.       pRightHand.for = 1
  454.       sprite(pTraySprite2).visible = 1
  455.       sprite(pTraySprite2).memberNum = 345
  456.     end if
  457.   end if
  458.   AlignObjectToHand(me)
  459.   return fre
  460. end
  461.  
  462. on TakeIceCream me
  463.   fre = 0
  464.   if spriteNum = 115 then
  465.     if (pLeftHand.type <> EMPTY) and (pRightHand.type <> EMPTY) then
  466.       if pLeftHand.type = "milkshake" then
  467.         pLeftHand.type = "icecream"
  468.         sprite(pTraySprite1).memberNum = 346
  469.       else
  470.         if pRightHand.type = "milkshake" then
  471.           pRightHand.type = "icecream"
  472.           sprite(pTraySprite2).memberNum = 346
  473.         end if
  474.       end if
  475.     end if
  476.   end if
  477.   if pLeftHand.type = EMPTY then
  478.     fre = fre + 1
  479.     pLeftHand.type = "icecream"
  480.     pLeftHand.for = 1
  481.     sprite(pTraySprite1).visible = 1
  482.     sprite(pTraySprite1).memberNum = 346
  483.   else
  484.     if pRightHand.type = EMPTY then
  485.       fre = fre + 1
  486.       pRightHand.type = "icecream"
  487.       pRightHand.for = 1
  488.       sprite(pTraySprite2).visible = 1
  489.       sprite(pTraySprite2).memberNum = 346
  490.     end if
  491.   end if
  492.   AlignObjectToHand(me)
  493.   return fre
  494. end
  495.  
  496. on GotMyDrink me, spr
  497.   if pLeftHand.type = "drink" then
  498.     return 1
  499.   else
  500.     if pRightHand.type = "drink" then
  501.       return 1
  502.     end if
  503.   end if
  504. end
  505.  
  506. on GiveDrink me, spr
  507.   if pLeftHand.type = "drink" then
  508.     pLeftHand.type = EMPTY
  509.     pLeftHand.for = 0
  510.     sprite(pTraySprite1).visible = 0
  511.   else
  512.     if pRightHand.type = "drink" then
  513.       pRightHand.type = EMPTY
  514.       pRightHand.for = 0
  515.       sprite(pTraySprite2).visible = 0
  516.     end if
  517.   end if
  518. end
  519.  
  520. on TakeOrders me
  521.   ords = []
  522.   if pLeftHand.type = "order" then
  523.     append(ords, pLeftHand.for)
  524.     pLeftHand.type = EMPTY
  525.     pLeftHand.for = 0
  526.     sprite(pTraySprite1).visible = 0
  527.   end if
  528.   if pRightHand.type = "order" then
  529.     append(ords, pRightHand.for)
  530.     pRightHand.type = EMPTY
  531.     pRightHand.for = 0
  532.     sprite(pTraySprite2).visible = 0
  533.   end if
  534.   sendSprite(3, #FlashOff)
  535.   return ords
  536. end
  537.  
  538. on dumpFood me, spr
  539.   if (pLeftHand.type = "food") and (pLeftHand.for = spr) then
  540.     pLeftHand.type = "trash"
  541.     sendSprite(6, #Flashy)
  542.     sprite(pTraySprite1).memberNum = 343
  543.     sprite(pFlagSprite1).visible = 0
  544.     return 
  545.   else
  546.     if (pRightHand.type = "food") and (pRightHand.for = spr) then
  547.       pRightHand.type = "trash"
  548.       sendSprite(6, #Flashy)
  549.       sprite(pTraySprite2).memberNum = 343
  550.       sprite(pFlagSprite2).visible = 0
  551.       return 
  552.     end if
  553.   end if
  554. end
  555.  
  556. on TakeMyTrash me, spr
  557.   fre = 0
  558.   if pLeftHand.type = EMPTY then
  559.     fre = fre + 1
  560.     pLeftHand.type = "trash"
  561.     pLeftHand.for = spr
  562.     sendSprite(6, #Flashy)
  563.     ScoreThis(me, "clean")
  564.     sprite(pTraySprite1).visible = 1
  565.     sprite(pTraySprite1).memberNum = 343
  566.   else
  567.     if pRightHand.type = EMPTY then
  568.       fre = fre + 1
  569.       pRightHand.type = "trash"
  570.       pRightHand.for = spr
  571.       sendSprite(6, #Flashy)
  572.       ScoreThis(me, "clean")
  573.       sprite(pTraySprite2).visible = 1
  574.       sprite(pTraySprite2).memberNum = 343
  575.     end if
  576.   end if
  577.   if gDoingTutorial then
  578.     if gTutorialStep = 15 then
  579.       if (pLeftHand.type = "trash") and (pRightHand.type = "trash") then
  580.         sendSprite(836, #show, 16)
  581.       end if
  582.     end if
  583.   end if
  584.   AlignObjectToHand(me)
  585.   return fre
  586. end
  587.  
  588. on GarbageCheck me
  589.   return [pLeftHand.type, pRightHand.type]
  590. end
  591.  
  592. on DumpTheTrash me
  593.   sou = 0
  594.   if (pLeftHand.type = "trash") or (pLeftHand.type = "drink") or (pLeftHand.type = "milkshake") or (pLeftHand.type = "icecream") then
  595.     pLeftHand.type = EMPTY
  596.     pLeftHand.for = 0
  597.     sou = 1
  598.     sprite(pTraySprite1).visible = 0
  599.   end if
  600.   if (pRightHand.type = "trash") or (pRightHand.type = "drink") or (pRightHand.type = "milkshake") or (pRightHand.type = "icecream") then
  601.     pRightHand.type = EMPTY
  602.     pRightHand.for = 0
  603.     sou = 1
  604.     sprite(pTraySprite2).visible = 0
  605.   end if
  606.   put "sou", sou
  607.   if sou then
  608.     put "playing garbage sound"
  609.     playSound(8, "garbage 2")
  610.   end if
  611.   sendSprite(6, #FlashOff)
  612.   AlignObjectToHand(me)
  613. end
  614.  
  615. on YouGotMyFood me, spr
  616.   if pLeftHand.type = "food" then
  617.     if pLeftHand.for = spr then
  618.       pLeftHand.type = EMPTY
  619.       pLeftHand.for = 0
  620.       AlignObjectToHand(me)
  621.       ScoreThis(me, "food")
  622.       sprite(pTraySprite1).visible = 0
  623.       sprite(pFlagSprite1).visible = 0
  624.       if gDoingTutorial then
  625.         if gTutorialStep = 12 then
  626.           if (pLeftHand.type = EMPTY) and (pRightHand.type = EMPTY) then
  627.             sendSprite(836, #show, 13)
  628.           end if
  629.         end if
  630.       end if
  631.       return 1
  632.     end if
  633.   end if
  634.   if pRightHand.type = "food" then
  635.     if pRightHand.for = spr then
  636.       pRightHand.type = EMPTY
  637.       pRightHand.for = 0
  638.       AlignObjectToHand(me)
  639.       ScoreThis(me, "food")
  640.       sprite(pTraySprite2).visible = 0
  641.       sprite(pFlagSprite2).visible = 0
  642.       if gDoingTutorial then
  643.         if gTutorialStep = 12 then
  644.           if (pLeftHand.type = EMPTY) and (pRightHand.type = EMPTY) then
  645.             sendSprite(836, #show, 13)
  646.           end if
  647.         end if
  648.       end if
  649.       return 1
  650.     end if
  651.   end if
  652.   return 0
  653. end
  654.  
  655. on GotMyBill me, spr
  656.   if (pLeftHand.type = EMPTY) or (pRightHand.type = EMPTY) then
  657.     ScoreThis(me, "check")
  658.     AlignObjectToHand(me)
  659.     return 1
  660.   end if
  661.   return 0
  662. end
  663.  
  664. on GotMySnack me, spr, typ
  665.   if typ = 1 then
  666.     want = "milkshake"
  667.   else
  668.     want = "icecream"
  669.   end if
  670.   if pLeftHand.type = want then
  671.     pLeftHand.type = EMPTY
  672.     pLeftHand.for = 0
  673.     AlignObjectToHand(me)
  674.     ScoreThis(me, "snack" & string(typ))
  675.     sprite(pTraySprite1).visible = 0
  676.     return 1
  677.   else
  678.     if pRightHand.type = want then
  679.       pRightHand.type = EMPTY
  680.       pRightHand.for = 0
  681.       AlignObjectToHand(me)
  682.       ScoreThis(me, "snack" & string(typ))
  683.       sprite(pTraySprite2).visible = 0
  684.       return 1
  685.     end if
  686.   end if
  687.   return 0
  688. end
  689.  
  690. on QueueMe me, spr, pt
  691.   if QueueList.count >= 21 then
  692.     put "too much already queue'd"
  693.     return 
  694.   end if
  695.   if spriteNum = 110 then
  696.     playSound(9, "queue1")
  697.   else
  698.     if spriteNum = 115 then
  699.       playSound(9, "queue1")
  700.     end if
  701.   end if
  702.   if (spr < 10) or (spr = 13) or (spr = 30) or (spr = 31) then
  703.     pt[2] = 105
  704.   end if
  705.   nextStop = [#sprite: spr, #movePoint: pt, #markSprite: pQueueSprites[1]]
  706.   append(QueueList, nextStop)
  707.   pAnimating = 1
  708.   pIdling = 0
  709.   skipMax = 2
  710.   sendSprite(pQueueSprites[1], #turnOn, spr)
  711.   deleteAt(pQueueSprites, 1)
  712.   if QueueList.count = 1 then
  713.     ChooseDirection(me, QueueList[1].movePoint)
  714.   end if
  715. end
  716.  
  717. on wipehelparray me
  718.   pTutFed = []
  719. end
  720.  
  721. on GotFreeHand me
  722.   if (pLeftHand.type = EMPTY) or (pRightHand.type = EMPTY) then
  723.     return 1
  724.   end if
  725. end
  726.  
  727. on InMyHands me
  728.   put pLeftHand
  729.   put pRightHand
  730. end
  731.  
  732. on CheckIntersect me
  733.   global gCollisionRects
  734.   c = gCollisionRects.count
  735.   repeat with b = 1 to c
  736.     if (sd.locH > gCollisionRects[b].rect.left) and (sd.locH < gCollisionRects[b].rect.right) then
  737.       if (sd.locV > gCollisionRects[b].rect.top) and (sd.locV < gCollisionRects[b].rect.bottom) then
  738.         if pDebuggin then
  739.           put "we collided with rect", gCollisionRects[b], sd.loc
  740.         end if
  741.         return gCollisionRects[b].rect
  742.         exit repeat
  743.       end if
  744.     end if
  745.   end repeat
  746.   return rect(0, 0, 0, 0)
  747. end
  748.  
  749. on ChooseDirection me, pt
  750.   dX = sd.locH - pt[1]
  751.   dY = sd.locV - pt[2]
  752.   moveToX = 0
  753.   moveToY = 0
  754.   if abs(dX) >= abs(dY) then
  755.     moveToX = pt[1]
  756.   else
  757.     moveToY = pt[2]
  758.   end if
  759.   if (pt[2] < 200) and (sd.locV < 200) then
  760.     moveToX = pt[1]
  761.     moveToY = 0
  762.   else
  763.     if pt[2] < 200 then
  764.       moveToY = pt[2]
  765.       moveToX = 0
  766.     else
  767.       if sd.locV < 200 then
  768.         moveToX = pt[1]
  769.         moveToY = 0
  770.       else
  771.         if sd.locV > 200 then
  772.           if (sd.locV < pt[2]) and (sd.locH > pt[1]) then
  773.             moveToX = pt[1]
  774.             moveToY = 0
  775.           end if
  776.         end if
  777.       end if
  778.     end if
  779.   end if
  780.   if pDebuggin then
  781.     put "choose dir", pt, moveToX, moveToY, dX, dY
  782.   end if
  783. end
  784.  
  785. on MoveTo me, pt, spr
  786.   if pDebuggin then
  787.     put "moveTo", pt, spr, speed, moveToX, moveToY, sd.loc
  788.   end if
  789.   speed = speed + pAccelRate
  790.   if speed > pMaxSpeed then
  791.     speed = pMaxSpeed
  792.     if spriteNum = 110 then
  793.       if pLastPoint.count > 0 then
  794.         deleteAt(pLastPoint, pLastPoint.count)
  795.       end if
  796.     end if
  797.   else
  798.     if pAccelRate > 0 then
  799.       addAt(pLastPoint, 1, sd.loc)
  800.       if pLastPoint.count > 5 then
  801.         deleteAt(pLastPoint, 6)
  802.       end if
  803.     else
  804.       if (pAccelRate < 0) and (speed < 1.0) then
  805.         speed = 1.0
  806.       else
  807.         if pAccelRate < 0 then
  808.           if pLastPoint.count > 0 then
  809.             deleteAt(pLastPoint, pLastPoint.count)
  810.           end if
  811.         end if
  812.       end if
  813.     end if
  814.   end if
  815.   lastH = sd.locH
  816.   lastY = sd.locV
  817.   if (abs(sd.locH - pt[1]) < 25) and (abs(sd.locV - pt[2]) < 25) and (pt[2] > 105) then
  818.     pAccelRate = -1 * abs(pAccelRate)
  819.     currFrame = 1
  820.   end if
  821.   if moveToX > 0 then
  822.     if sd.locH <= moveToX then
  823.       sd.locH = sd.locH + speed
  824.       if sd.locH >= moveToX then
  825.         sd.locH = moveToX
  826.         moveToY = pt[2]
  827.         moveToX = 0
  828.       end if
  829.     else
  830.       if sd.locH >= moveToX then
  831.         sd.locH = sd.locH - speed
  832.         if sd.locH <= moveToX then
  833.           sd.locH = moveToX
  834.           moveToY = pt[2]
  835.           moveToX = 0
  836.         end if
  837.       else
  838.       end if
  839.     end if
  840.     amountIn = CheckIntersect(me)
  841.     if pDebuggin then
  842.       put "hit something?", amountIn
  843.     end if
  844.     if amountIn <> rect(0, 0, 0, 0) then
  845.       if sd.locH < lastH then
  846.         sd.locH = amountIn.right
  847.       else
  848.         sd.locH = amountIn.left
  849.       end if
  850.       moveToX = 0
  851.       put "move to x", 0
  852.       if sd.locV >= pt[2] then
  853.         moveToY = amountIn.top
  854.       else
  855.         moveToY = amountIn.bottom
  856.       end if
  857.     end if
  858.   else
  859.     if moveToY > 0 then
  860.       if sd.locV < moveToY then
  861.         sd.locV = sd.locV + speed
  862.         if sd.locV >= moveToY then
  863.           sd.locV = moveToY
  864.           moveToX = pt[1]
  865.           moveToY = 0
  866.         end if
  867.       else
  868.         if sd.locV > moveToY then
  869.           sd.locV = sd.locV - speed
  870.           if sd.locV <= moveToY then
  871.             sd.locV = moveToY
  872.             moveToX = pt[1]
  873.             moveToY = 0
  874.           end if
  875.         else
  876.         end if
  877.       end if
  878.       amountIn = CheckIntersect(me)
  879.       if pDebuggin then
  880.         put "hit something? y", amountIn, lastY, sd.locV
  881.       end if
  882.       if amountIn <> rect(0, 0, 0, 0) then
  883.         if sd.locV < lastY then
  884.           sd.locV = amountIn.bottom
  885.         else
  886.           sd.locV = amountIn.top
  887.         end if
  888.         moveToY = 0
  889.         put "move to y", 0
  890.         if sd.locH >= pt[1] then
  891.           moveToX = amountIn.left
  892.         else
  893.           moveToX = amountIn.right
  894.         end if
  895.       end if
  896.     end if
  897.   end if
  898.   if sd.locH > lastH then
  899.     pDirFacing = 4
  900.   else
  901.     if sd.locH < lastH then
  902.       pDirFacing = 2
  903.     else
  904.       if sd.locV > lastY then
  905.         pDirFacing = 1
  906.       else
  907.         if sd.locV < lastY then
  908.           pDirFacing = 3
  909.         end if
  910.       end if
  911.     end if
  912.   end if
  913.   if sd.loc = pt then
  914.     if pDebuggin then
  915.       put "we're there", sd.loc, pt
  916.     end if
  917.     speed = 0.0
  918.     pAccelRate = abs(pAccelRate)
  919.     if spr = 675 then
  920.       pLastAction = EMPTY
  921.     end if
  922.     sendSprite(spr, #WhatDoYouWant)
  923.     pLastMoveTime = GetTime()
  924.     pDestY = 0
  925.     sendSprite(QueueList[1].markSprite, #turnOff)
  926.     append(pQueueSprites, QueueList[1].markSprite)
  927.     deleteAt(QueueList, 1)
  928.     pLastPoint = []
  929.     repeat with b = 325 to 329
  930.       sprite(b).visible = 0
  931.     end repeat
  932.     if QueueList.count > 0 then
  933.       if pDebuggin then
  934.         put "need to choose dir", pDirFacing
  935.       end if
  936.       ChooseDirection(me, QueueList[1].movePoint)
  937.     else
  938.       currFrame = sFrame
  939.       if (spr >= 15) and (spr <= 28) then
  940.         pDirFacing = 4
  941.       else
  942.         if (spr >= 40) and (spr <= 69) then
  943.           pDirFacing = 4
  944.         else
  945.           pDirFacing = 1
  946.         end if
  947.       end if
  948.     end if
  949.   end if
  950. end
  951.  
  952. on getPropertyDescriptionList
  953.   vPDList = [:]
  954.   setaProp(vPDList, #pTraySprite1, [#comment: "left tray:", #format: #integer, #default: 111])
  955.   setaProp(vPDList, #pTraySprite2, [#comment: "right tray:", #format: #integer, #default: 112])
  956.   setaProp(vPDList, #pFlagSprite1, [#comment: "left flag:", #format: #integer, #default: 113])
  957.   setaProp(vPDList, #pFlagSprite2, [#comment: "right flag:", #format: #integer, #default: 114])
  958.   return vPDList
  959. end
  960.