So take the asteroids template for example. In that template the bullet speed is the same regardless of the player ship current speed/moving angle, but how could one take into account the current moving angle of the player to adjust the bullet to fire more realistically?
You would want to do some vector addition - The original speed and angle of the bullet added to the speed and angle of the player. The most straightforward way would be to take the x and y velocities separately and just add them to their respective velocities. Unfortunately the bullet behavior doesn't have access to individual velocities on each axis.
The neat thing is you can have multiple bullet behaviors on the same object. So add a second bullet behavior to the bullet object, and set the angle and speed of the second bullet behavior to the angle and speed of the player object. Assuming you're using custom movement like in the example, it would look like so:
-> Bullet: Set Bullet2 angle of motion to Player.CustomMovement.MovingAngle degrees
-> Bullet: Set Bullet2 speed to Player.CustomMovement.Speed
Develop games in your browser. Powerful, performant & highly capable.
that's a creative solution, seems to work. Thanks oosyrag