[問題] 急問 這要怎麼寫呢?
以下是我的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)
→
01/11 01:40, , 1F
01/11 01:40, 1F
→
01/11 13:58, , 2F
01/11 13:58, 2F
→
01/11 20:03, , 3F
01/11 20:03, 3F
Flash 近期熱門文章
PTT數位生活區 即時熱門文章