(6) 执行Window→Message命令,打开Message(消息)窗口。运行程序,并依次按下键盘上的:“↑”、“↓”、“←”、“→”4个方向键,在其窗口中可以看到按键的数值被检测出来,如图7-164所示。

图7-164 Message窗口中的信息
(7) 双击Script通道的第28帧,打开Script窗口,输入以下Lingo语句,如图7-165所示。
global positionx
global positiony
on exitFrame me
go to the frame
end
on keyup
positionx=the loch of sprite 2
positiony=the locv of sprite 2
case the keycode of
123:
set the loch of sprite 2 to positionx–5
124:
set the loch of sprite 2 to positionx+5
125:
set the locv of sprite 2 to positiony+5
126:
set the locv of sprite 2 to positiony-5
end case
end

图7-165 第2帧的Lingo脚本
(8) 至此,键盘控制动画的制作完成了,播放电影,效果如图7-166所示。
本节实例很简单,可以举一反三创建出精彩的动画效果。

图7-166 键盘控制播放效果 |