home *** CD-ROM | disk | FTP | other *** search
/ PC Open 10 / pcopen10.iso / aaron / dida / puzzle.dxr / 00011_Assegnazioni.ls < prev    next >
Encoding:
Text File  |  1997-09-24  |  9.3 KB  |  330 lines

  1. on startMovie
  2.   global Percorso, Psuoni, Macchina, Nfile, num, grandezza, segno, voce, Lingua
  3.   set voce to Lingua & 0
  4.   voce()
  5.   nascondi()
  6.   NASCONDIPUZZLE()
  7.   updateStage()
  8.   go("luce1")
  9.   set Percorso to the pathName
  10.   set Psuoni to Percorso & "Snd" & segno
  11.   set grandezza to 0
  12. end
  13.  
  14. on stopMovie
  15.   global msprite
  16.   set msprite to 0
  17. end
  18.  
  19. on pigia
  20.   global Psuoni
  21.   sound playFile 2, Psuoni & "click.aif"
  22. end
  23.  
  24. on Sbagliato
  25.   global Psuoni
  26.   sound playFile 2, Psuoni & "nyuk1.aif"
  27. end
  28.  
  29. on giusto
  30.   global Psuoni, Lingua, segno
  31.   if Lingua = 0 then
  32.     sound playFile 2, Psuoni & "alleluj2.aif"
  33.   else
  34.     sound playFile 2, Psuoni & "ing" & segno & "alleluj2.aif"
  35.   end if
  36. end
  37.  
  38. on nascondi
  39.   repeat with n = 2 to 7
  40.     set the visible of sprite n to 0
  41.   end repeat
  42.   set the visible of sprite 11 to 0
  43.   updateStage()
  44. end
  45.  
  46. on NASCONDIPUZZLE
  47.   repeat with n = 12 to 48
  48.     set the visible of sprite n to 0
  49.   end repeat
  50.   updateStage()
  51. end
  52.  
  53. on pulsante
  54.   global altezza, larghezza, grandezza
  55.   if the stillDown then
  56.     if (larghezza > 0) and (larghezza < 87) and (altezza > 0) and (altezza < 140) then
  57.       set the visible of sprite 5 to 1
  58.       updateStage()
  59.     end if
  60.   else
  61.     set the visible of sprite 5 to 0
  62.   end if
  63. end
  64.  
  65. on Crealista1
  66.   global listapuzzle, soluzione, qq
  67.   set aggiungi to 1
  68.   set listapuzzle to list()
  69.   set x to random(9) + 30 + ((qq - 1) * 60)
  70.   set dim to 1
  71.   addAt(listapuzzle, 1, x)
  72.   repeat while dim < 9
  73.     set x to random(9) + 30 + ((qq - 1) * 60)
  74.     repeat with j = 1 to dim
  75.       if x = getAt(listapuzzle, j) then
  76.         set aggiungi to 0
  77.       end if
  78.     end repeat
  79.     if aggiungi then
  80.       append(listapuzzle, x)
  81.       set dim to dim + 1
  82.     end if
  83.     set aggiungi to 1
  84.   end repeat
  85.   repeat with i = 1 to 9
  86.     puppetSprite(i + 11, 1)
  87.     set x to getAt(listapuzzle, i)
  88.     set the memberNum of sprite (i + 11) to x
  89.   end repeat
  90.   set soluzione to list()
  91.   repeat with i = 1 to 9
  92.     addAt(soluzione, i, i + 30 + ((qq - 1) * 60))
  93.   end repeat
  94. end
  95.  
  96. on Mostralista1
  97.   repeat with n = 12 to 20
  98.     set the visible of sprite n to 1
  99.     puppetSprite(n, 1)
  100.     updateStage()
  101.   end repeat
  102. end
  103.  
  104. on Mostralista2
  105.   repeat with n = 12 to 47
  106.     set the visible of sprite n to 1
  107.     puppetSprite(n, 1)
  108.     updateStage()
  109.   end repeat
  110. end
  111.  
  112. on MOSTRALISTA3
  113.   repeat with n = 12 to 17
  114.     set the visible of sprite n to 1
  115.     puppetSprite(n, 1)
  116.     updateStage()
  117.   end repeat
  118. end
  119.  
  120. on Crealista2
  121.   global listapuzzle, soluzione, qq
  122.   set aggiungi to 1
  123.   set listapuzzle to list()
  124.   set x to random(36) + 46 + ((qq - 1) * 60)
  125.   set dim to 1
  126.   addAt(listapuzzle, 1, x)
  127.   repeat while dim < 36
  128.     set x to random(36) + 46 + ((qq - 1) * 60)
  129.     repeat with j = 1 to dim
  130.       if x = getAt(listapuzzle, j) then
  131.         set aggiungi to 0
  132.       end if
  133.     end repeat
  134.     if aggiungi then
  135.       append(listapuzzle, x)
  136.       set dim to dim + 1
  137.     end if
  138.     set aggiungi to 1
  139.   end repeat
  140.   repeat with i = 1 to 36
  141.     puppetSprite(i + 11, 1)
  142.     set x to getAt(listapuzzle, i)
  143.     set the memberNum of sprite (i + 11) to x
  144.   end repeat
  145.   set soluzione to list()
  146.   repeat with i = 1 to 36
  147.     addAt(soluzione, i, i + 46 + ((qq - 1) * 60))
  148.   end repeat
  149. end
  150.  
  151. on CREALISTA3
  152.   global listapuzzle, soluzione, qq
  153.   set aggiungi to 1
  154.   set listapuzzle to list()
  155.   set x to random(6) + 40 + ((qq - 1) * 60)
  156.   set dim to 1
  157.   addAt(listapuzzle, 1, x)
  158.   repeat while dim < 6
  159.     set x to random(6) + 40 + ((qq - 1) * 60)
  160.     repeat with j = 1 to dim
  161.       if x = getAt(listapuzzle, j) then
  162.         set aggiungi to 0
  163.       end if
  164.     end repeat
  165.     if aggiungi then
  166.       append(listapuzzle, x)
  167.       set dim to dim + 1
  168.     end if
  169.     set aggiungi to 1
  170.   end repeat
  171.   repeat with i = 1 to 6
  172.     puppetSprite(i + 11, 1)
  173.     set x to getAt(listapuzzle, i)
  174.     set the memberNum of sprite (i + 11) to x
  175.   end repeat
  176.   set soluzione to list()
  177.   repeat with i = 1 to 6
  178.     addAt(soluzione, i, i + 40 + ((qq - 1) * 60))
  179.   end repeat
  180. end
  181.  
  182. on mouseDown
  183.   global listapuzzle, altezza, larghezza, bordi, m, msprite, grandezza
  184.   if (larghezza > 109) and (larghezza < 475) and (altezza > 77) and (altezza < 404) then
  185.     if grandezza = 1 then
  186.       set c1 to 122
  187.       set c2 to 109
  188.       repeat with j = 0 to 2
  189.         if (altezza < (77 + (c2 * (j + 1)))) and (altezza > (77 + (c2 * j))) then
  190.           repeat with i = 0 to 2
  191.             if (larghezza < (109 + (c1 * (i + 1)))) and (larghezza > (109 + (c1 * i))) then
  192.               set m to getAt(listapuzzle, i + 1 + (3 * j))
  193.               set bordi to rect(109 + (c1 * i), 77 + (c2 * j), 109 + (c1 * (i + 1)), 77 + (c2 * (j + 1)))
  194.               set msprite to i + (3 * j) + 12
  195.             end if
  196.           end repeat
  197.         end if
  198.       end repeat
  199.     end if
  200.     if grandezza = 2 then
  201.       set c1 to 61
  202.       set c2 to 54
  203.       repeat with j = 0 to 5
  204.         if (altezza < (78 + (c2 * (j + 1)))) and (altezza > (78 + (c2 * j))) then
  205.           repeat with i = 0 to 5
  206.             if (larghezza < (109 + (c1 * (i + 1)))) and (larghezza > (109 + (c1 * i))) then
  207.               set m to getAt(listapuzzle, i + 1 + (6 * j))
  208.               set bordi to rect(109 + (c1 * i), 78 + (c2 * j), 109 + (c1 * (i + 1)), 78 + (c2 * (j + 1)))
  209.               set msprite to i + (6 * j) + 12
  210.             end if
  211.           end repeat
  212.         end if
  213.       end repeat
  214.     end if
  215.     if grandezza = 3 then
  216.       set c1 to 122
  217.       set c2 to 165
  218.       repeat with j = 0 to 1
  219.         if (altezza < (76 + (c2 * (j + 1)))) and (altezza > (76 + (c2 * j))) then
  220.           repeat with i = 0 to 2
  221.             if (larghezza < (108 + (c1 * (i + 1)))) and (larghezza > (108 + (c1 * i))) then
  222.               set m to getAt(listapuzzle, i + 1 + (3 * j))
  223.               set bordi to rect(108 + (c1 * i), 76 + (c2 * j), 108 + (c1 * (i + 1)), 76 + (c2 * (j + 1)))
  224.               set msprite to i + (3 * j) + 12
  225.             end if
  226.           end repeat
  227.         end if
  228.       end repeat
  229.     end if
  230.   end if
  231. end
  232.  
  233. on mouseUp
  234.   global larghezza, altezza, m, bordi, listapuzzle, grandezza, soluzione, msprite, qq
  235.   if msprite <> 0 then
  236.     if (larghezza > 109) and (larghezza < 475) and (altezza > 77) and (altezza < 404) then
  237.       if grandezza = 1 then
  238.         set c1 to 122
  239.         set c2 to 109
  240.         set n to m
  241.         set nsprite to msprite
  242.         repeat with j = 0 to 2
  243.           if (altezza < (77 + (c2 * (j + 1)))) and (altezza > (77 + (c2 * j))) then
  244.             repeat with i = 0 to 2
  245.               if (larghezza < (109 + (c1 * (i + 1)))) and (larghezza > (109 + (c1 * i))) then
  246.                 set n to getAt(listapuzzle, i + 1 + (3 * j))
  247.                 set nsprite to i + (3 * j) + 12
  248.               end if
  249.             end repeat
  250.           end if
  251.         end repeat
  252.         set the memberNum of sprite msprite to n
  253.         set the memberNum of sprite nsprite to m
  254.         set the rect of sprite msprite to bordi
  255.         updateStage()
  256.         set p to getAt(listapuzzle, msprite - 11)
  257.         set q to getAt(listapuzzle, nsprite - 11)
  258.         addAt(listapuzzle, nsprite - 11, p)
  259.         deleteAt(listapuzzle, nsprite - 10)
  260.         addAt(listapuzzle, msprite - 11, q)
  261.         deleteAt(listapuzzle, msprite - 10)
  262.         if listapuzzle = soluzione then
  263.           giusto()
  264.           set grandezza to 0
  265.         end if
  266.       end if
  267.       if grandezza = 2 then
  268.         set c1 to 61
  269.         set c2 to 54
  270.         set n to m
  271.         set nsprite to msprite
  272.         repeat with j = 0 to 5
  273.           if (altezza < (78 + (c2 * (j + 1)))) and (altezza > (78 + (c2 * j))) then
  274.             repeat with i = 0 to 5
  275.               if (larghezza < (109 + (c1 * (i + 1)))) and (larghezza > (109 + (c1 * i))) then
  276.                 set n to getAt(listapuzzle, i + 1 + (6 * j))
  277.                 set nsprite to i + (6 * j) + 12
  278.               end if
  279.             end repeat
  280.           end if
  281.         end repeat
  282.         set the memberNum of sprite msprite to n
  283.         set the memberNum of sprite nsprite to m
  284.         set the rect of sprite msprite to bordi
  285.         updateStage()
  286.         set p to getAt(listapuzzle, msprite - 11)
  287.         set q to getAt(listapuzzle, nsprite - 11)
  288.         addAt(listapuzzle, nsprite - 11, p)
  289.         deleteAt(listapuzzle, nsprite - 10)
  290.         addAt(listapuzzle, msprite - 11, q)
  291.         deleteAt(listapuzzle, msprite - 10)
  292.         if listapuzzle = soluzione then
  293.           giusto()
  294.           set grandezza to 0
  295.         end if
  296.       end if
  297.       if grandezza = 3 then
  298.         set c1 to 122
  299.         set c2 to 165
  300.         set n to m
  301.         set nsprite to msprite
  302.         repeat with j = 0 to 1
  303.           if (altezza < (76 + (c2 * (j + 1)))) and (altezza > (76 + (c2 * j))) then
  304.             repeat with i = 0 to 2
  305.               if (larghezza < (108 + (c1 * (i + 1)))) and (larghezza > (108 + (c1 * i))) then
  306.                 set n to getAt(listapuzzle, i + 1 + (3 * j))
  307.                 set nsprite to i + (3 * j) + 12
  308.               end if
  309.             end repeat
  310.           end if
  311.         end repeat
  312.         set the memberNum of sprite msprite to n
  313.         set the memberNum of sprite nsprite to m
  314.         set the rect of sprite msprite to bordi
  315.         updateStage()
  316.         set p to getAt(listapuzzle, msprite - 11)
  317.         set q to getAt(listapuzzle, nsprite - 11)
  318.         addAt(listapuzzle, nsprite - 11, p)
  319.         deleteAt(listapuzzle, nsprite - 10)
  320.         addAt(listapuzzle, msprite - 11, q)
  321.         deleteAt(listapuzzle, msprite - 10)
  322.         if listapuzzle = soluzione then
  323.           giusto()
  324.           set grandezza to 0
  325.         end if
  326.       end if
  327.     end if
  328.   end if
  329. end
  330.