Target works when mouse not moving

This commit is contained in:
KGrzeg 2021-10-14 18:42:15 +02:00
parent 0b2f410824
commit b2fb042a90

View file

@ -52,6 +52,11 @@ export default class Ship extends Phaser.Physics.Arcade.Sprite {
if (this.scene.input.activePointer.leftButtonDown())
this.bullets!.fireBullet(time, this);
this.rotation = Phaser.Math.Angle.BetweenPoints(
this,
this.scene.input.activePointer
) + Math.PI / 2
this.body.velocity.add(vec)
this.scene.physics.world.wrap(this, this.wrapMargin)
}