home *** CD-ROM | disk | FTP | other *** search
/ Encyklopedia Omnia / Planeta.iso / data / e_gen_pl.dir / 00023_IconDragger2.ls < prev    next >
Encoding:
Text File  |  1999-06-27  |  2.4 KB  |  81 lines

  1. property nsIntersector, origLoc, draggedSprite, corretto, maxErrori, numEsatti
  2. global gNumErrori, gNumEsatti
  3.  
  4. on beginSprite
  5.   set draggedSprite to the currentSpriteNum
  6.   set the cursor of sprite draggedSprite to [member "palmo", member "palmo_m"]
  7. end
  8.  
  9. on mouseUp
  10.   tastoSu()
  11. end
  12.  
  13. on mouseDown
  14.   tastoGiu()
  15. end
  16.  
  17. on rightMouseUp
  18.   tastoSu()
  19. end
  20.  
  21. on rightMouseDown
  22.   tastoGiu()
  23. end
  24.  
  25. on tastoGiu
  26.   set draggedSprite to the currentSpriteNum
  27.   if the moveableSprite of sprite draggedSprite = 1 then
  28.     set the cursor of sprite draggedSprite to [member "pugno", member "pugno_m"]
  29.     set origLoc to the loc of sprite draggedSprite
  30.   end if
  31. end
  32.  
  33. on tastoSu
  34.   if the moveableSprite of sprite draggedSprite = 1 then
  35.     if spriteInside(draggedSprite, nsIntersector) then
  36.       if corretto = #si then
  37.         puppetSound(1, "E_si")
  38.         set gNumEsatti to gNumEsatti + 1
  39.         set the cursor of sprite draggedSprite to 0
  40.         set newLoc to the loc of sprite draggedSprite
  41.         set the loc of sprite draggedSprite to newLoc
  42.         set the moveableSprite of sprite draggedSprite to 0
  43.         updateStage()
  44.         if gNumEsatti = numEsatti then
  45.           go(marker(2))
  46.         end if
  47.       else
  48.         puppetSound(1, "E_no")
  49.         set gNumErrori to gNumErrori + 1
  50.         set the cursor of sprite draggedSprite to [member "palmo", member "palmo_m"]
  51.         set the loc of sprite draggedSprite to origLoc
  52.         updateStage()
  53.         if gNumErrori > maxErrori then
  54.           go(#next)
  55.         end if
  56.       end if
  57.     else
  58.       set the cursor of sprite draggedSprite to [member "palmo", member "palmo_m"]
  59.       set the loc of sprite draggedSprite to origLoc
  60.       updateStage()
  61.     end if
  62.   end if
  63. end
  64.  
  65. on spriteInside pFreeSprite, pFixedSprite
  66.   set freeRect to the rect of sprite pFreeSprite
  67.   set fixedRect to the rect of sprite pFixedSprite
  68.   set p1 to point(getAt(freeRect, 1), getAt(freeRect, 2))
  69.   set p2 to point(getAt(freeRect, 3), getAt(freeRect, 4))
  70.   if inside(p1, fixedRect) and inside(p2, fixedRect) then
  71.     return 1
  72.   else
  73.     return 0
  74.   end if
  75. end
  76.  
  77. on getPropertyDescriptionList
  78.   set p_list to [#nsIntersector: [#comment: "Sprite Intersector:", #format: #integer, #default: 9], #corretto: [#comment: "Esatto?", #format: #symbol, #range: [#si, #no], #default: #no], #maxErrori: [#comment: "Max errori:", #format: #integer, #default: 2], #numEsatti: [#comment: "Risposte esatte:", #format: #integer, #default: 2]]
  79.   return p_list
  80. end
  81.