frokenstein Posted November 10, 2014 Share Posted November 10, 2014 I am making a game which involves a ship that can fire missiles. I've figured out how to get the missiles to fire in the same direction the ship is facing but I want them to emerge from the same location on to the ship (ie. the front of the ship). Does Phaser have a way to get the x, y of the center or edges of a sprite? The alternative is to hack together some sin/cos logic but so far that method has proven "interesting". Please let me know, thanks. Link to comment Share on other sites More sharing options...
lewster32 Posted November 10, 2014 Share Posted November 10, 2014 I'd go for the trigonometry approach. Don't resist it and stick with it and it'll start to become clear. This example shows how to get a point an arbitrary radius away from the center: http://jsfiddle.net/lewster32/5P2zG/ Link to comment Share on other sites More sharing options...
frokenstein Posted November 11, 2014 Author Share Posted November 11, 2014 Thanks, Lewster Link to comment Share on other sites More sharing options...
Recommended Posts