![マイマップ] [1]iは、ステージの内部で打ったとき、私の形をしたい回転させ、真の角度での移動をcountinueの永遠
私は私のプロジェクトでビリヤードのボールをシミュレートします。 しかし、私のコードはうまくいきません。 壁(この例ではステージ)でヒットしたときに(たとえば)34度で始まると、真の度合いで復帰します。フラッシュで は、AS3
public function loop(e:Event) : void
{
if(luanch)
{
y += Math.sin(degreesToRadians(rotation)) * speed;
x += Math.cos(degreesToRadians(rotation)) * speed;
if (x > stage.stageWidth){
rotation -= 90;
x = stage.stageWidth;
trace("X :" , x , rotation);
}
else if (x < 0)
{
rotation += 90;
x=3;
//rotation += 90;
trace("X :" , x , rotation);
}
if (y > stage.stageHeight)
{
y = stage.stageHeight;
rotation -= 90;
trace("Y : " , y , rotation);
}
else if (y <0)
{
rotation += 90;
//rotation += 90;
trace("Y :" , y , rotation);
}
}
}
public function degreesToRadians(degrees:Number) : Number
{
return degrees * Math.PI/180;
}
}
}
あなたの質問がありますか? – 2smacks