[問題] 製作拼圖遊戲...期末作業
我用count做累計
可是宣告
if (count >= 5)
{
gotoAndStop(4);
只要一直用滑鼠點物件超過規定的次數就會跳出去關卡
這是我的程式↓
var xx, yy, c, id;
this.onEnterFrame = function()
{
if (c >= 0)
{
eval("s" + id)._x = eval("s" + id)._x + xx;
eval("s" + id)._y = eval("s" + id)._y + yy;
c--;
}
};
P1.onPress = function()
{
this.startDrag(true);
};
P1.onRelease = function()
{
stopDrag();
if (this.hitTest(S1))
{
count++;
this._x = S1._x;
this._y = S1._y;
}
};
P2.onPress = function()
{
this.startDrag(true);
};
P2.onRelease = function()
{
this.stopDrag();
if(this.hitTest(S2))
{
this._x=S2._x;
this._y=S2._y;
}
else
{
c=10;
xx=(xx-this._x)/10;
yy=(yy-this._y)/10;
}
};
P3.onPress = function()
{
this.startDrag(true);
};
P3.onRelease = function()
{
stopDrag();
if (this.hitTest(S3))
{
count++;
this._x = S3._x;
this._y = S3._y;
}
};
P4.onPress = function()
{
this.startDrag(true);
};
P4.onRelease = function()
{
stopDrag();
if (this.hitTest(S4))
{
count++;
this._x = S4._x;
this._y = S4._y;
}
};
P5.onPress = function()
{
this.startDrag(true);
};
P5.onRelease = function()
{
stopDrag();
if (this.hitTest(S5))
{
count++;
this._x = S5._x;
this._y = S5._y;
}
};
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 223.142.175.34
Flash 近期熱門文章
PTT數位生活區 即時熱門文章