home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 5 / boot-disc-1997-01.iso / media / demos.dir / 00021_Script_FlipperClass < prev    next >
Text File  |  1996-11-05  |  3KB  |  85 lines

  1. property spritenum,castlist,baseheight,curcast,numsteps,basewidth
  2. property duration,lasttime,ancestor,callback,oldduration,pausedflag
  3.  
  4. on new me,startcastname,endcastname,myduration,mylongduration,mycallback
  5.   set startcastnum=the number of member startcastname
  6.   set endcastnum=the number of member endcastname
  7.   set castlist=[]
  8.   set curcast=startcastnum
  9.   repeat with index=startcastnum to endcastnum
  10.     add castlist,index
  11.   end repeat
  12.   set spritenum=castspritea(startcastname)
  13.   puppetsprite spritenum,true
  14.   set baseheight=the height of sprite spritenum
  15.   set basewidth=the width of sprite spritenum
  16.   set numsteps=6
  17.   set pausedflag=false
  18.   set duration=myduration*60
  19.   set oldduration=duration
  20.   set lasttime=the ticks
  21.   set ancestor=new(script "GenericClass")
  22.   clearactorlist me,"FlipperClass",#spritenum
  23.   set ancestor=0
  24.   set callback=default("",mycallback)
  25.   add the actorlist, me
  26.   return me
  27. end
  28.  
  29. on flip me,clickedFlag,reverseFlag
  30.   set pausedflag=false
  31.   if clickedFlag then
  32.     set duration=15*60
  33.     set lasttime=the ticks
  34.   end if
  35.   repeat with index=numsteps-1 down to 0
  36.     set height=baseheight*index/numsteps
  37.     set width=basewidth*index/numsteps
  38.     set the height of sprite spritenum to height
  39.     set the width of sprite spritenum to width
  40.     updateStage
  41.   end repeat
  42.   if reverseflag then
  43.     set curpos=(getpos(castlist,curcast)-1)
  44.     if curpos=0 then 
  45.       set curpos=count(castlist)
  46.     end if
  47.   else
  48.     set curpos=(getpos(castlist,curcast) mod count(castlist))+1
  49.   end if
  50.   set newcast=getat(castlist,curpos)
  51.   set the membernum of sprite spritenum to newcast
  52.   if voidp(clickedflag) then set clickedflag=false
  53.   if not(voidP(callback) or (callback="")) then
  54.     do callback&"e&(the name of member newcast)"e&","&clickedflag
  55.   end if
  56.   repeat with index=0 to numsteps
  57.     set height=baseheight*index/numsteps
  58.     set width=basewidth*index/numsteps
  59.     set the height of sprite spritenum to height
  60.     set the width of sprite spritenum to width
  61.     updateStage
  62.   end repeat
  63.   set curcast=newcast
  64.   return the name of member curcast
  65. end
  66.  
  67. on stepframe me
  68.   if pausedflag then exit
  69.   if lasttime+duration>the ticks then exit
  70.   set castname=flip(me)
  71.   set lasttime=the ticks
  72.   set duration=oldduration
  73. end
  74.  
  75. on select me,whichcastname
  76.   set tempcastnum=the number of member whichcastname
  77.   if tempcastnum>0 then
  78.     set curcast=tempcastnum-1
  79.     if curcast=0 then
  80.       set curcast=count(castlist)
  81.     end if
  82.     flip me,true
  83.   end if
  84. end
  85.