(8) 单击工具栏中的Script按钮,弹出Script窗口,设置脚本类型为Movie,在其中输入以下全局变量,如图8-71~图8-73所示。
global mylist
global lsglist
global flag1
global flag2
global flag3
global flag4
global flag5
global flag6
global flag7
global flag8
global flag9
global flag10
global flag11
global flag12
global flag13
global flag14
global flag15
global deletelist
global mycount
on init
flag1=0
flag2=0
flag3=0
flag4=0
flag5=0
flag6=0
flag7=0
flag8=0
flag9=0
flag10=0
flag11=0
flag12=0
flag13=0
flag14=0
flag15=0
deletelist=[]
mycount=0
-- 生成随机序列
seed=15
lsglist=[]
mylist=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
num=random(7)+8
-- put num
repeat with x=1 to num
position=random(seed)
which=getat(mylist,position)+1
append(lsglist,which)
deleteat(mylist,position)
-- put lsglist
seed=seed–1
end repeat
-- 初始化硬币
-- 所有硬币和光晕不可见
repeat with x=2 to 16
sprite(x).visible=0
sprite(x+15).visible=0
end repeat
-- 显示随机硬币
repeat with x=1 to count(lsglist)
display=getat(lsglist,x)
sprite(display+15).visible=1
end repeat
end
on startMovie
flag1=0
flag2=0
flag3=0
flag4=0
flag5=0
flag6=0
flag7=0
flag8=0
flag9=0
flag10=0
flag11=0
flag12=0
flag13=0
flag14=0
flag15=0
deletelist=[]
mycount=0
-- 生成随机序列
seed=15
lsglist=[]
mylist=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
num=random(7)+8
-- put num
repeat with x=1 to num
position=random(seed)
which=getat(mylist,position)+1
append(lsglist,which)
deleteat(mylist,position)
-- put lsglist
seed=seed–1
end repeat
-- 初始化硬币
-- 所有硬币和光晕不可见
repeat with x=2 to 16
sprite(x).visible=0
sprite(x+15).visible=0
end repeat
-- 显示随机硬币
repeat with x=1 to count(lsglist)
display=getat(lsglist,x)
sprite(display+15).visible=1
end repeat
end startMovie

图8-71 Movie脚本1

图8-72 Movie脚本2

图8-73 Movie脚本3
|