home *** CD-ROM | disk | FTP | other *** search
/ Encyklopedia Omnia / Planeta.iso / data / a_gen.dir / 00062_scrollingArray.ls < prev    next >
Encoding:
Text File  |  2000-11-14  |  2.7 KB  |  88 lines

  1. property numOfSlots, firstSlotNS, castName, scrollDir, voidCrop, numOfCrops
  2. global gCurrentStartCrop, gCropList, gCanClick
  3.  
  4. on beginSprite
  5.   set numOfCrops to the number of castMembers of castLib castName
  6.   if scrollDir = #left then
  7.     set gCropList to []
  8.     repeat with i = 1 to numOfCrops
  9.       add(gCropList, the name of member i of castLib castName)
  10.     end repeat
  11.     set gCurrentStartCrop to 1
  12.     aggiornaFreccie()
  13.   end if
  14. end
  15.  
  16. on mouseUp
  17.   if gCanClick then
  18.     if scrollDir = #right then
  19.       set gCurrentStartCrop to gCurrentStartCrop + 2
  20.     else
  21.       set gCurrentStartCrop to gCurrentStartCrop - 2
  22.     end if
  23.     updateCrops()
  24.     aggiornaFreccie()
  25.     updateStage()
  26.   end if
  27. end
  28.  
  29. on updateCrops
  30.   repeat with i = 1 to numOfSlots
  31.     set Ns to firstSlotNS + i - 1
  32.     set nm to getAt(gCropList, gCurrentStartCrop + (2 * (i - 1)))
  33.     if nm <> EMPTY then
  34.       set the member of sprite Ns to member nm of castLib castName
  35.       set the moveableSprite of sprite Ns to 1
  36.     else
  37.       set the member of sprite Ns to member voidCrop
  38.       set the moveableSprite of sprite Ns to 0
  39.     end if
  40.     set Ns to firstSlotNS + i + 2
  41.     set nm to getAt(gCropList, gCurrentStartCrop + (2 * (i - 1)) + 1)
  42.     if nm <> EMPTY then
  43.       set the member of sprite Ns to member nm of castLib castName
  44.       set the moveableSprite of sprite Ns to 1
  45.       next repeat
  46.     end if
  47.     set the member of sprite Ns to member voidCrop
  48.     set the moveableSprite of sprite Ns to 0
  49.   end repeat
  50. end
  51.  
  52. on aggiornaFreccie
  53.   set Ns to the currentSpriteNum
  54.   if scrollDir = #right then
  55.     if gCurrentStartCrop < (numOfCrops - (numOfSlots * 2) + 1) then
  56.       set the visible of sprite Ns to 1
  57.     else
  58.       set the visible of sprite Ns to 0
  59.     end if
  60.     if gCurrentStartCrop > 1 then
  61.       set the visible of sprite (Ns - 1) to 1
  62.     else
  63.       set the visible of sprite (Ns - 1) to 0
  64.     end if
  65.   else
  66.     if gCurrentStartCrop > 1 then
  67.       set the visible of sprite Ns to 1
  68.     else
  69.       set the visible of sprite Ns to 0
  70.     end if
  71.     if gCurrentStartCrop < (numOfCrops - (numOfSlots * 2) + 1) then
  72.       set the visible of sprite (Ns + 1) to 1
  73.     else
  74.       set the visible of sprite (Ns + 1) to 0
  75.     end if
  76.   end if
  77. end
  78.  
  79. on getPropertyDescriptionList
  80.   set d to [:]
  81.   addProp(d, #numOfSlots, [#default: 3, #format: #integer, #comment: "Numero di slots:"])
  82.   addProp(d, #firstSlotNS, [#default: 15, #format: #integer, #comment: "Numero canale primo slot:"])
  83.   addProp(d, #castName, [#default: "a_crop4", #format: #string, #comment: "Nome del castLib:"])
  84.   addProp(d, #scrollDir, [#default: #left, #format: #symbol, #range: [#right, #left], #comment: "Direzione di scroll:"])
  85.   addProp(d, #voidCrop, [#default: "voidCrop", #format: #string, #comment: "Nome del crop fittizio:"])
  86.   return d
  87. end
  88.