Hi_Its_Shaun Posted August 6, 2017 Share Posted August 6, 2017 Hello, I have a game with a larger than camera sized game world and I would like to display an arrow to an off screen sprite. I'd like the arrow to be pinned to the edge of the camera and of course rotate so the tip of the arrow points towards the sprite. Bonus if the arrow also disappears when the target sprite is in the bounds of the camera. Has anyone got any help on how to implement this? Link to comment Share on other sites More sharing options...
loki1991 Posted September 27, 2017 Share Posted September 27, 2017 use sprite.fixedToCamera = true;https://phaser.io/examples/v2/camera/fixed-to-camera for the arrow, create the sprite then move the anchor to where you want it to rotate from. //this will center the anchor. sprite.anchor.setTo(0.5, 0.5); // this will rotate the arrow towards the new object sprite.rotation = game.physics.arcade.angleBetween(sprite, targetSprite);https://phaser.io/examples/v2/arcade-physics/angle-between this is stuff that is available on the actual phaser.io though and I haven't even managed to make a game with phaser and could find this in a few minutes. Link to comment Share on other sites More sharing options...
Recommended Posts