常见Lingo指令介绍
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
常见Lingo指令介绍
一、控制Sprite的常见指令
1.指令名称:sprite member
指令语法:the member of sprite
指令说明:sprite所代表的cast member。
例:精灵替换
set the member of sprite 1 to "yuan"
可改为:Sprite(1).member=”yuan”
点句表示法:
ObjectName.[Property|function|Chunk that you want to specity]
2.指令名称:sprite memberNum
指令语法:the memberNum of sprite
指令说明:sprite所代表的cast member所在的位置。
例:循环播放
on exitFrame me
if sprite (1). memberNum =10 then
sprite (1). memberNum = 1
else
sprite (1) .memberNum=sprite(1).memberNum+1
end if
go to the frame
end
3.旋转、倾斜、翻转精灵
指令说明:这些变换可以应用于位图、文本、矢量图形、GIF及Flash,但不能用于域,以及工具面板上的椭圆和矩形。
(1)旋转:正值代表顺时针,负值代表逆时针
sprite(1).rotation=30
set the rotation of sprite 1 to 30
例:指针调节
sprite(1).rotation=sprite(1).rotation+5
(2)倾斜:正值向右倾斜,负值向左倾斜,正常状态为0
sprite(1).skew=10
set the skew of sprite 1 to 10
例:图形变形
sprite(1).skew=sprite(1).skew+10
(3)翻转:左右(水平)翻转flipH,上下(垂直)翻转flipV,设置值为TRUE或FALSE (1或0)
sprite(1).flipH=TURE
sprite(1).flipV=1
例:翻转与恢复
指令说明:相当于sprite在stage上的透明度,值可从0到100,数值越小透明度越高。Sprite(1).blend=50
Set the blend of sprite 1 to 50
例:图像渐淡
sprite(1).blend=50
5.指令名称:loc、locH、locV
指令说明:the loc of sprite:sprite当前的位置,相当于point(the loch, the locV)
the locH of sprite:水平位置
the locV of sprite:垂直位置
sprite(1).loc=point(320,240)------point
sprite(1).locH=320――数值
sprite(1).locV=240――数值
例:设置精灵位置
sprite(1).loc=point(320,240)
6.locZ
指令说明:sprite目前在Z轴上的高度。Channels之间存在高低与前后的关系,channel小的sprite位于下层,channel大的sprite位于上层。
例:点击相应图片移到最上层。
on startMovie
global highestCard
highestCard=5
end
on mouseUp
global highestCard
highestCard=highestCard+1
sprite(the clickOn).locZ=highestCard
end
7.Top、bottom、Left、right
指令说明:环绕sprite长方形的上下左右坐标。
on mouseUp me
put sprite(1).top
put sprite(1).bottom
put sprite(1).left
put sprite(1).right
end
用massage窗口查看。例:文字上下或左右反复运动。
Put Sprite(1).rect
例:匹配题intersects的应用
指令说明:在stage上留下残影
sprite(1).trails=true
9.updatestage
更新画面,常用于显示连续的动作
例:拖尾移动
on mouseUp me
sprite(1).trails=true
repeat with x=1 to 100
sprite(1).locH=sprite(1).locH+2
updatestage
end repeat
end
10.foreColor、backColor
控制演员前景色、背景色的属性。
注意:这个属性主要用于用“tools palette”工具画出的Shape(向量)图形
例:鼠标点击循环改变精灵的前景(背景)色
on mouseUp me
sprite(1).foreColor=sprite(1).foreColor-1
end
11.constraint
指令说明:将某一可移动的sprite的中心点的活动范围限制在另一个sprite的四周边框内。
on startMovie
sprite(1).constraint=2-- 2代表sprite(2)
12.visible
指令说明:sprite在stage上可见或隐藏。一个隐藏的sprite仍具有位置、尺寸等各种属性,只是视觉上看不见而已。
Sprite(1).visible=false
13.puppetSprite
判断某一sprite是否处于puppet状态,是时,其属性与行为将由Lingo控制,否则依据score window中的设置。
例:将sprite 1设置为puppet状态。
On prepateMovie
puppetSprite 1, true
end
14.quad
控制sprite的四个顶点,用数组的方式来存放四个点的坐标值,依序分别为左上、右上、右下、左下,改变四个点的坐标,可以改变sprite的图框形状