playMaker

Author Topic: About the Direction of Enemy Bullets  (Read 1112 times)

ken168

  • Playmaker Newbie
  • *
  • Posts: 11
About the Direction of Enemy Bullets
« on: May 07, 2023, 10:54:08 AM »
I am a beginner trying to use Playmaker to build my SHMUP game. I have a fighter jet that battles against alien monsters. I have given the alien monsters various attack methods. I want one of the alien monsters' bullets to be able to aim and shoot at my fighter jet, but it's not a tracking bullet. The bullet just flies in the direction of the fighter jet. Once the fighter jet moves away from its initial position, the alien monster's bullet does not track or turn, but flies out of the screen in a straight line according to its original trajectory.

I used to use Move Towards, but the bullets would only closely follow the fighter jet, which is not what I wanted.

This problem has been bothering me for a long time. The alien monster's bullet is a prefab that can be fired several times at once. I don't know how to set the bullet's flight path. Each time it is fired, it needs to first confirm the position of the fighter jet, but it does not track the fighter jet.

Could you please advise me on how to handle this problem? Thank you very much.

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 256
Re: About the Direction of Enemy Bullets
« Reply #1 on: May 09, 2023, 05:38:24 PM »
Could just get the current position of your player and shoot the bullet towards that position. Might need give it an additional offset so the bullet flies out of the screen. Then disable it, pool it and re-use it to be shot again.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: About the Direction of Enemy Bullets
« Reply #2 on: May 10, 2023, 08:01:16 AM »
Hi.
You could also use velocity instead.

Rotate it towards a direction, then :
for 3d you can use Set Velocity
for 2d you can use Set Forward Velocity 2D (Ecosystem)