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

Get help using Construct 2

### » Sun Feb 26, 2017 12:50 pm

Any way to change that?
B
10
S
4
Posts: 37
Reputation: 880

### » Sun Feb 26, 2017 12:58 pm

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
B
26
S
7
Posts: 254
Reputation: 2,389

### » Sun Feb 26, 2017 2:11 pm

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.
Banned User
B
29
S
7
G
58
Posts: 1,229
Reputation: 34,910

### » Sun Feb 26, 2017 3:07 pm

lamar wrote: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.

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

but it doesn't work
B
10
S
4
Posts: 37
Reputation: 880

### » Sun Feb 26, 2017 3:31 pm

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.
Banned User
B
29
S
7
G
58
Posts: 1,229
Reputation: 34,910

### » Sun Feb 26, 2017 3:57 pm

lamar wrote: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...

http://imgur.com/a/WVUB6
B
10
S
4
Posts: 37
Reputation: 880

### » Sun Feb 26, 2017 4:19 pm

Turaco wrote:
lamar wrote: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...

http://imgur.com/a/WVUB6

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
Banned User
B
29
S
7
G
58
Posts: 1,229
Reputation: 34,910

### » Sun Feb 26, 2017 4:34 pm

lamar wrote:
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.
B
10
S
4
Posts: 37
Reputation: 880

### » Sun Feb 26, 2017 5:13 pm

Turaco wrote:
lamar wrote:
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!
Banned User
B
29
S
7
G
58
Posts: 1,229
Reputation: 34,910

### » Sun Feb 26, 2017 5:32 pm

lamar wrote:
Turaco wrote:
lamar wrote:
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
B
10
S
4
Posts: 37
Reputation: 880