读书人

flash台球(批改)(急)(AS2.0)

发布时间: 2013-01-04 10:04:18 作者: rapoo

flash台球(修改)(急)(AS2.0)
1。可以把白波射向不同角度
2。在放上3个波(随便放可以了...),设计如果白波碰撞到它们散开




Mouse.hide();
stick.startDrag(true);

stick.onMouseMove = function() {
dX = _root._xmouse-this._x;
dY = _root._ymouse-this._y;
angle = Math.atan2(dY, dX);
this._rotation = angle/Math.PI*180;
};


stick.onPress = function() {
ball._x = 360;
ball._y = 180;
power = 0;
powerAmount.text = power;
hitAmount = 0;
trackMouse = true;
mouseStart = _xmouse;

};


stick.onRelease = function () {
stick.gotoandStop ("PullBack");
hitAmount = power;
trackMouse = false;

}

onEnterFrame = function() {
if (hitAmount > 5) {

ball._x -= power/2;

if (ball._x < 0)power*=-1;
if (ball._x > (Stage.width - ball._width) ) power*=-1;
trace(ball._x);

ball._y -= power/2;


if (ball._y < 0)power*=-1;
if (ball._y > (Stage.width - ball._width) ) power*=-1;
trace(ball._y);




hitAmount -= 2;


}
}
onMouseMove = function() {



if (trackMouse == true) {
power = _xmouse - mouseStart;
powerAmount.text = power;

if (trackMouse == true) {
power = _ymouse - mouseStart;
powerAmount.text = power;

}
}


}
[解决办法]
//鼠标在球桌上显示为对齐标志
Mouse.hide();
if (_xmouse != center._x && _ymouse != center._y) {
startDrag("center", true);
}
center._alpha = 100;
} else {
//鼠标离开球桌恢复显示
Mouse.show();
if (_xmouse == center._x && _ymouse == center._y) {
center.stopDrag();
}
center._alpha = 0;
}

读书人网 >Flash

热点推荐