Target works when mouse not moving
This commit is contained in:
parent
0b2f410824
commit
b2fb042a90
1 changed files with 5 additions and 0 deletions
|
|
@ -52,6 +52,11 @@ export default class Ship extends Phaser.Physics.Arcade.Sprite {
|
||||||
if (this.scene.input.activePointer.leftButtonDown())
|
if (this.scene.input.activePointer.leftButtonDown())
|
||||||
this.bullets!.fireBullet(time, this);
|
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.body.velocity.add(vec)
|
||||||
this.scene.physics.world.wrap(this, this.wrapMargin)
|
this.scene.physics.world.wrap(this, this.wrapMargin)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue