home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boot Disc 5
/
boot-disc-1997-01.iso
/
media
/
demos.dir
/
00021_Script_FlipperClass
< prev
next >
Wrap
Text File
|
1996-11-05
|
3KB
|
85 lines
property spritenum,castlist,baseheight,curcast,numsteps,basewidth
property duration,lasttime,ancestor,callback,oldduration,pausedflag
on new me,startcastname,endcastname,myduration,mylongduration,mycallback
set startcastnum=the number of member startcastname
set endcastnum=the number of member endcastname
set castlist=[]
set curcast=startcastnum
repeat with index=startcastnum to endcastnum
add castlist,index
end repeat
set spritenum=castspritea(startcastname)
puppetsprite spritenum,true
set baseheight=the height of sprite spritenum
set basewidth=the width of sprite spritenum
set numsteps=6
set pausedflag=false
set duration=myduration*60
set oldduration=duration
set lasttime=the ticks
set ancestor=new(script "GenericClass")
clearactorlist me,"FlipperClass",#spritenum
set ancestor=0
set callback=default("",mycallback)
add the actorlist, me
return me
end
on flip me,clickedFlag,reverseFlag
set pausedflag=false
if clickedFlag then
set duration=15*60
set lasttime=the ticks
end if
repeat with index=numsteps-1 down to 0
set height=baseheight*index/numsteps
set width=basewidth*index/numsteps
set the height of sprite spritenum to height
set the width of sprite spritenum to width
updateStage
end repeat
if reverseflag then
set curpos=(getpos(castlist,curcast)-1)
if curpos=0 then
set curpos=count(castlist)
end if
else
set curpos=(getpos(castlist,curcast) mod count(castlist))+1
end if
set newcast=getat(castlist,curpos)
set the membernum of sprite spritenum to newcast
if voidp(clickedflag) then set clickedflag=false
if not(voidP(callback) or (callback="")) then
do callback&"e&(the name of member newcast)"e&","&clickedflag
end if
repeat with index=0 to numsteps
set height=baseheight*index/numsteps
set width=basewidth*index/numsteps
set the height of sprite spritenum to height
set the width of sprite spritenum to width
updateStage
end repeat
set curcast=newcast
return the name of member curcast
end
on stepframe me
if pausedflag then exit
if lasttime+duration>the ticks then exit
set castname=flip(me)
set lasttime=the ticks
set duration=oldduration
end
on select me,whichcastname
set tempcastnum=the number of member whichcastname
if tempcastnum>0 then
set curcast=tempcastnum-1
if curcast=0 then
set curcast=count(castlist)
end if
flip me,true
end if
end