How do I make an spread for weapons?

  • Ay bois, this is jut an simple question, that, is how to make an decent spread in Pistols/UZIS/Rifles and more. It's an 2d game and, i want an simple and good spread to use in weapons, somehow i tried 4 codes and they didn't worked, and, i'm lazy to think more or just make an spread with duct tape & glue. So, if you know, please tell me!

  • Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    So for example something like:

    Bullet is created >

    Rotate 360 degrees to mouse.x, mouse.y

    Set angle self.angle + random(-5,5)

  • Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    So for example something like:

    Bullet is created >

    Rotate 360 degrees to mouse.x, mouse.y

    Set angle self.angle + random(-5,5)

    It's possible to use Angle of motion in the bullet behavior? Because i used it but, didn't worked, The code i'm using is:

    On Left button pressed

    Every FireRate Seconds

    Pistol spawn Bullet on layer Bullets (image point: fire)

    Bullet set angle of motion: round(random(-10,10))

    But, somehow, it didn't work.

  • It's a question of mine, and, I was wondering if I could use it or not.

  • Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    So for example something like:

    Bullet is created >

    Rotate 360 degrees to mouse.x, mouse.y

    Set angle self.angle + random(-5,5)

    Oh, i almost forgot, thanks for the code buddy! And, i have a question about your code, why is necessary the rotate 360 degrees?

  • > Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    >

    > So for example something like:

    >

    > Bullet is created >

    > Rotate 360 degrees to mouse.x, mouse.y

    > Set angle self.angle + random(-5,5)

    Oh, i almost forgot, thanks for the code buddy! And, i have a question about your code, why is necessary the rotate 360 degrees?

    Angle of motion should work as well, does your bullet have movement? Can you post the relevant code section?

    360 is necessary for that event because the parameter is the max degrees the object can rotate toward the object in a tick. So if you do 360 it can set the angle in a single tick.

  • > > Side scrolling or top down? Either way, just add a random amount of angle to each bullet when created after you've set it's target.

    > >

    > > So for example something like:

    > >

    > > Bullet is created >

    > > Rotate 360 degrees to mouse.x, mouse.y

    > > Set angle self.angle + random(-5,5)

    >

    > Oh, i almost forgot, thanks for the code buddy! And, i have a question about your code, why is necessary the rotate 360 degrees?

    Angle of motion should work as well, does your bullet have movement? Can you post the relevant code section?

    360 is necessary for that event because the parameter is the max degrees the object can rotate toward the object in a tick. So if you do 360 it can set the angle in a single tick.

    Hmm i see, so, i'm gonna upload the code that i used, and, other code that i tried to see if something happens, but, none of these worked.

    Link 1: imgur.com/a/2OTNVQO

    Link 2: imgur.com/a/5IGXnLm

  • What is your bullet speed?

  • What is your bullet speed?

    It's 1000, but, i don't see the speed like he's gonna mess up.

  • Can you post the code section?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you post the code section?

    Hey bro! Didn't need to make an spread, i just improved a bit your code and it works perfectly! Btw, thanks for it, but, you could help me in other thing?

  • > Can you post the code section?

    Hey bro! Didn't need to make an spread, i just improved a bit your code and it works perfectly! Btw, thanks for it, but, you could help me in other thing?

    What's the other thing?

  • > > Can you post the code section?

    >

    > Hey bro! Didn't need to make an spread, i just improved a bit your code and it works perfectly! Btw, thanks for it, but, you could help me in other thing?

    What's the other thing?

    It's my other thread about making the text to go on a value, like, increasing the text in this way: Exp got in the round: 50

    Text that shows exp got: go to 0 to 50, in this way: 0, 1 ,2 ,3 ,4 ,5 ,6 and going fast if the value is higher or not. ( There's a full thread about this, so, you can find him and see better the thing i want, and in the thread theres an example too. 0

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