0 Favourites

My turret is shooting at the origin point of it's target

  • Any way to change that?

  • Sure. You're modelling a weapon that has 0 spread, essentially. Just add a random amount to the angle of the bullet to represent the spread of the weapon

  • You can add a random spread to the bullet or add sine to the enemy which makes it tougher to hit the target.

    I use sine for a lot of enemies as it creates a more natural AI.

  • You can add a random spread to the bullet or add sine to the enemy which makes it tougher to hit the target.

    I use sine for a lot of enemies as it creates a more natural AI.

    How do I add a random spread to the bullet?

    I tried:

    On Bullet created -> Set Bullet angle of motion to Bullet.Bullet.AngleOfMotion + round(random(-20,20))

    but it doesn't work

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • When you say it doesn't work what is it doing when you run that event?

    If you are using 360 degree rotations you will need to determine if bullet is at 0 degrees or subtracting 20 from 0 will not give you the right degree.

    Add bullet angle >20 and it should work.

  • When you say it doesn't work what is it doing when you run that event?

    If you are using 360 degree rotations you will need to determine if bullet is at 0 degrees or subtracting 20 from 0 will not give you the right degree.

    Add bullet angle >20 and it should work.

    Whatever I do, the bullet still shoots at the exact position of the origin point, every single time...

  • > When you say it doesn't work what is it doing when you run that event?

    >

    > If you are using 360 degree rotations you will need to determine if bullet is at 0 degrees or subtracting 20 from 0 will not give you the right degree.

    >

    > Add bullet angle >20 and it should work.

    >

    Whatever I do, the bullet still shoots at the exact position of the origin point, every single time...

    Try setting the bullet to the angle the turret is facing and add in your random spread

    Set bullet angle to turret facing angle+random(-20,20)

    Turret facing angle >20

  • Try setting the bullet to the angle the turret is facing and add in your random spread

    Set bullet angle to turret facing angle+random(-20,20)

    Turret facing angle >20

    I tried setting the bullet angleofmotion to static 50 degrees. It changed nothing, the bullet still fired to its target

    Edit: I found out that if a bullet has no speed itself, it will only move in the angle the turret is shooting. So what I did was change the angle of turret by -10 to 10 degrees at the moment its shooting. it looks funny, kinda like recoil. But I like it.

  • >

    >

    > Try setting the bullet to the angle the turret is facing and add in your random spread

    >

    > Set bullet angle to turret facing angle+random(-20,20)

    > Turret facing angle >20

    >

    I tried setting the bullet angleofmotion to static 50 degrees. It changed nothing, the bullet still fired to its target

    Edit: I found out that if a bullet has no speed itself, it will only move in the angle the turret is shooting. So what I did was change the angle of turret by -10 to 10 degrees at the moment its shooting. it looks funny, kinda like recoil. But I like it.

    That s basically the same as adding random spread to the bullet just using the turret angle instead.

    Glad you got it figured out!

  • >

    > >

    > >

    > > Try setting the bullet to the angle the turret is facing and add in your random spread

    > >

    > > Set bullet angle to turret facing angle+random(-20,20)

    > > Turret facing angle >20

    > >

    >

    > I tried setting the bullet angleofmotion to static 50 degrees. It changed nothing, the bullet still fired to its target

    >

    > Edit: I found out that if a bullet has no speed itself, it will only move in the angle the turret is shooting. So what I did was change the angle of turret by -10 to 10 degrees at the moment its shooting. it looks funny, kinda like recoil. But I like it.

    >

    That s basically the same as adding random spread to the bullet just using the turret angle instead.

    Glad you got it figured out!

    Thank you for helping me

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