How do I make the bullets shotgun?

Get help using Construct 2

Post » Thu Feb 05, 2015 10:36 pm

Image

Here's the "code".

Problem is, that my gun shoots in a line.

Image

How do I make it spread?
B
7
Posts: 28
Reputation: 333

Post » Thu Feb 05, 2015 10:54 pm

I may be wrong, but what would happen if between each "Spawn bullet" you add "set angle"?. That way each bullet will have a different angle and not all the same (or that is how it should work :P )
B
8
Posts: 26
Reputation: 348

Post » Thu Feb 05, 2015 10:56 pm

add 'For each' within 'On created' ShotgunBullet
ImageImage
B
102
S
45
G
22
Posts: 772
Reputation: 21,493

Post » Thu Feb 05, 2015 11:14 pm

Image

Like this? It didn't work :/

I'm testing Cosme's while I'm at it.

EDIT: Nope, this didn't work either...

Image
B
7
Posts: 28
Reputation: 333

Post » Fri Feb 06, 2015 12:04 am

Strange.. it works fine on mine, even when I disabled for each
You do not have the required permissions to view the files attached to this post.
ImageImage
B
102
S
45
G
22
Posts: 772
Reputation: 21,493

Post » Fri Feb 06, 2015 3:20 am

What if you use angle and not bullet angle. Does it change anything?
B
8
Posts: 26
Reputation: 348

Post » Fri Feb 06, 2015 1:46 pm

If i just use angle instead of bullet angle, I get the same effect.

However.

If I disable this, it seems to work properly.
Image

But it's weird, because it's not the bullets, but the shotgun itself that is aimed at the mouse. So it should not effect the bullets?
B
7
Posts: 28
Reputation: 333

Post » Fri Feb 06, 2015 1:58 pm

If you set angle to Shotgun.angle+random(-30,30) instead, it should work.
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Fri Feb 06, 2015 2:08 pm

Excyis, instead of "spawn" you should use "create" and then set angle of motion to "turret.angle + random(-30, 30)":

https://www.scirra.com/forum/039-on-created-039-angle-changing-does-not-when-spawning_t83604
Last edited by razorMonkey on Fri Feb 06, 2015 2:09 pm, edited 1 time in total.
B
12
S
6
G
2
Posts: 99
Reputation: 1,727

Post » Fri Feb 06, 2015 2:09 pm

Still shooting in straight line...

Image

EDIT: this one worked.

Image


Thank you everyone for trying to help me!
B
7
Posts: 28
Reputation: 333


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests