Jump to content

Can Phaser create Vector?


woratana
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...