How do I shoot multiple bullets in an angle?

0 favourites
  • 8 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • i am trying to make an enemy shoot different amount of bullets at the player. for example, lets say i want to shoot 3 bullets at the angle of the enemy towards the player, one of the bullets will go directly towards the player while the other two will be slightly deviated from the player

    (the red line is the angle of the enemy to the player)

    i found a not very good way to do this. it requires copy and pasting code and changing the added angle all the time, which its not good if you want to shoot like 32 bullets at the player

    so if you guys know a better way to this, i would really like to know how

  • i found a not very good way to do this. it requires copy and pasting code and changing the added angle all the time, which its not good if you want to shoot like 32 bullets at the player

    what do you mean?

  • i think i am not very good at explaining things so i am gonna leave this c3p here

    dropbox.com/s/qn558f14rf8ec1q/bullet_hell_test.c3p

  • If you want the enemy to shoot more bullets you modify the time right? The logic looks fine there. You can add a instance variable to an enemy which acts as shooting speed and use this every enemy.variable seconds.

  • sorry, but i am not talking about the shooting speed but rather about the amount of bullets that spawns at the same time

  • You want to use a repeat loop to spawn bullets.

    For example if you had 2 bullets spawn, one on either side, in 5 degree increments, you would use

    + System: Repeat 16 times

    -> System: Create object Bullet on layer 0 at (0, 0), create hierarchy: False

    -> Bullet: Set angle to Bullet.Angle+LoopIndex×5 degrees

    -> System: Create object Bullet on layer 0 at (0, 0), create hierarchy: False

    -> Bullet: Set angle to Bullet.Angle-LoopIndex×5 degrees

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Looks good

  • You want to use a repeat loop to spawn bullets.

    For example if you had 2 bullets spawn, one on either side, in 5 degree increments, you would use

    + System: Repeat 16 times

    -> System: Create object Bullet on layer 0 at (0, 0), create hierarchy: False

    -> Bullet: Set angle to Bullet.Angle+LoopIndex×5 degrees

    -> System: Create object Bullet on layer 0 at (0, 0), create hierarchy: False

    -> Bullet: Set angle to Bullet.Angle-LoopIndex×5 degrees

    Yeah! this is exactly what i was trying to find!

    ty

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)