|
obj.prototype.onEnterFrame = function() {
//落下設定
this.ySpeed += this.ySpeedAdd;
//加速
this._x += this.xSpeed;
this._y += this.ySpeed;
//着地判定
if (this._y+(this._height/2)>100) {
//地面に当たったら
this._y -= (this._y+(this._height/2))-100;
//地面を軸に座標を反転
if (this.ySpeed>0.05) {
//バウンドの力で判断
this.ySpeed *= -this.bound;
this.xSpeed *= this.bound;
} else {
//バウンドが弱まったら
delete this.onEnterFrame;//処理をとめる
}
}
};
Object.registerClass("objects", obj);
|