作者gargouille (lol)
看板Flash
标题Re: [问题] 随机跳跃
时间Wed May 23 12:40:28 2007
※ 引述《KazuhaToyama ()》之铭言:
: 要一个Movie Clip 在800,600之中随机跑来跑去
: 可以设定
: onClipEvent (enterFrame) {
: this._x = math.random()*800;
: this._y = math.random()*600;
: }
: 但是我发现他跳动的速度很快
: 要他跳一个地方停三秒的话,要怎麽写呢^^
: 谢谢
另外有个东西可以用:
getTimer() : Number
传回从开始播放 SWF 档起所经过的毫秒数。
var timer:Number = getTimer();
var duration:Number = 3000; // 要停留的时间,毫秒
this.onEnterFrame = function(){
if(getTimer() - timer > duration){
timer = getTimer();
this._x = Math.random()*800;
this._y = Math.random()*600;
}
}
希望能有帮助 ^^"
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.80.237.118