私は宇宙飛行士にこの問題があります:二重火災と測位の問題
私の宇宙船が発射します。弾丸は船に合わせて中央に配置されています。現在、すべての弾丸はシングルショットです。
今私が持っていたいのは、船の二重火災です。基本的には、私はショットを倍にして、船の左右の の側に置く必要があります。しかし、私はそれを正確に行う方法を知らない。
私が持っているもう一つの問題は、弾丸のx座標とy座標を変更して、弾丸を船の中心から左(または右)に移動させ、船と火を回転させることです弾丸の奇妙な行動。この場合、彼らは船を参照して左から中央に、そしてその逆に動く(回転および発射中)。
問題がどこにあるのか、どうやったらいいですか?私は非常に多くの助けに感謝します。 TIA!:)
private function autoShoot(step:Number):void {
projectileManager.projectilePoolCount = projectileManager.projectilePool.length - 1;
asteroidManager.asteroidCount = asteroidManager.asteroids.length;
if (projectileManager.lastProjectileShot > projectileOffset && projectileManager.projectilePoolCount > 0 &&
playerStarted && asteroidManager.asteroidCount > 0 && projNumber < projectileNumber)
{
dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND, Main.SOUND_PLAYER_SHOOT,
false, 0, 8, 1));
tempProjectile = projectileManager.projectilePool.pop();
tempProjectile.projectileDelayCount = 0;
var projectileRadians:Number = (player.frame/360) * 6.28;
projShots++;
projNumber++;
if (projNumber >= projectileNumber)
{
player.startDelay = true;
}
tempProjectile.x = (player.point.x) + Math.cos(projectileRadians);
tempProjectile.y = (player.point.y) + Math.sin(projectileRadians);
tempProjectile.x = player.x + 13;
tempProjectile.y = player.y + 13;
tempProjectile.nextX = tempProjectile.x;
tempProjectile.nextY = tempProjectile.y;
tempProjectile.dx = rotationVectorList[player.frame].x;
tempProjectile.dy = rotationVectorList[player.frame].y;
tempProjectile.speed = projectileSpeed;
tempProjectile.frame = 0;
tempProjectile.bitmapData = tempProjectile.animationList[0];
tempProjectile.projectileDelay = 10;
projectileManager.projectiles.push(tempProjectile);
projectileManager.lastProjectileShot = 0;
} else {
projectileManager.lastProjectileShot += step;
}
}
弾丸クラスを作成する必要があります。あなたが必要とするのは、必要なときに弾丸をインスタンス化することだけです。始点、終点、速度、摩擦(もしあれば)、および軌道を制御する。それはあなたのためにすべてを簡素化するはずです –
私はすでに弾丸クラスを持っています。しかし、現在、それは単一のショットのためだけに働いています。二重火災ではありません。 – drpelz
それは私のポイントデュアルショットは2つの弾丸です。だから、あなたは2弾丸武器を持っていると、2弾丸クラスのオブジェクトをインスタンス化します。 1つのショットと2つの弾丸クラスの2つのタイプを作る –