woratana Posted December 17, 2013 Share Posted December 17, 2013 Hello, I am trying to do the shooting game where the bullet sprite is need to be rotated and move in specified angle. So I need to be able to calculate velocity.x and velocity.y from given vector's magnitude and angle. Is there any helper class in Phaser or javascript that can calculate vector? or do I need to create one? I am already creating one the hard way. If there is helper class it would be helpful Link to comment Share on other sites More sharing options...
XekeDeath Posted December 17, 2013 Share Posted December 17, 2013 The Phaser.Point class has some vector math in it, but I don't know how much... I only used the normalize function... There is also the Phaser.Math class to look at... Link to comment Share on other sites More sharing options...
rich Posted December 17, 2013 Share Posted December 17, 2013 There are quite a few vector related functions in Phaser.Math (that will work happily with a Point object). There isn't a native vec2 implementation yet. I have made one, but I don't want to add it unless it's really needed, so am thinking it over. When we start integrating p2.js in the New Year we will most likely just use the vec2 they've got, which is why I'm hesitant to add one in just now and then have to replace it. Link to comment Share on other sites More sharing options...
woratana Posted December 17, 2013 Author Share Posted December 17, 2013 Okay Sounds good to me. After New Year would be a blast for Phaser ! Link to comment Share on other sites More sharing options...
Recommended Posts