1
私はボールの動きをカーブさせようとしています。このコードは、オブジェクトをまっすぐに動かしてオブジェクトを回転させますが、カーブモーションでは動きません。非AS3コーダの場合Curve By Codeこのコードでどのようにしますか?
if (this.ballstart.hitTestObject(this.back)) {
trace("Hit back");
trace("ballstart rotation: " + this.ballstart.rotation);
removeEventListener(Event.ENTER_FRAME, update);
addEventListener(Event.ENTER_FRAME, BowlingScoreClass);
} else {
trace("move to back");
this.ballstart
this.ballstart.rotation -= -30;
//trace("this ballstart rotation: " + this.ballstart.rotation);
this.ballstart.y = this.ballstart.y - speed;
speed = 15;
/*speed = speed + 0.01;*/
if (this.ballstart.y < -height) {
x = Math.sin(this.ballstart.rotation * (Math.PI/180)) * speed;
y = Math.cos(this.ballstart.rotation * (Math.PI/180)) * speed * -1;
this.ballstart.x += x;
this.ballstart.y += y;
}
}
、上記のコードは、私のプロジェクトの(FPSを経由して)表示のリフレッシュ機能の間に実行されることを理解しています。ここでは、.rotation
はオブジェクトを独自の軸で回転させるだけです。カーブモーションを作るにはballstart.x
とballstart.y
を制御する必要があります。
また、このコードはvモーションで移動しますが、スムーズな治療が必要です。これを行うにはどのように変更しますか?私はトップコードでカーブする必要がありますか?
if (sprite.y > 500) {
trace(height);
sprite.y -= 4;
sprite.x += 4;
} else if (sprite.y > 400) {
trace(height);
sprite.y -= 4
sprite.x += 2
} else if(sprite.y > this.height) {
sprite.y -= 4
sprite.x -= 2
}
作品以下の答えが、その後 '✓'アイコンを使用してソリューションとしてそれをマークした場合 –