作者AlexanderMax (阿MAN)
看板Flash
标题[问题] 急问 这要怎麽写呢?
时间Mon Jan 11 00:38:00 2010
以下是我的code
我想要在我随机产生的东西上
可以用滑鼠点它然後前往下一个场景播放
我要怎麽写呢?
有哪位神人可以帮我这个大忙?
onClipEvent (load) {
//data you may want to change
width = 1280;
height = 800;
speed = Math.round(Math.random()*3)+1;
//initial positions
x = this._x=Math.random()*width;
y = this._y=Math.random()*height;
x_new = Math.random()*width;
y_new = Math.random()*height;}
onClipEvent (enterFrame) {
//x movement
if (x_new>this._x) {sign_x = 1;}
else {sign_x = -1;}
dx = Math.abs(x_new-this._x);
if ((dx>speed) || (dx<-speed))
{this._x += sign_x*speed;}
else {x_new = Math.random()*width;}
//y movement
if (y_new>this._y) {sign_y = 1;}
else {sign_y = -1;}
dy = Math.abs(y_new-this._y);
if ((dy>speed) || (dy<-speed))
{this._y += sign_y*speed;}
else {y_new = Math.random()*height;}
}
--
※ 编辑: AlexanderMax 来自: 61.217.195.47 (01/11 01:40)
1F:→ aquarianboy:也许你需要先学一下什麽是缩排喔 :) 01/11 01:40
2F:→ emily114005:推 楼上 01/11 13:58
3F:→ wind50321:可以试着使用 Flash Sript视窗上方的自动格式化按钮 01/11 20:03