How do I make a flak cannon?

Get help using Construct 2

Post » Wed Sep 21, 2016 2:48 am

Essentially, I want a bullet that, when it comes within certain range of something else, will explode and shoot off shrapnel. I've tried using Line of Sight and Distance, but nothing seems to work.
B
7
S
1
Posts: 6
Reputation: 387

Post » Wed Sep 21, 2016 3:43 am

I'm not sure why checking the distance wouldn't work. Would you mind sharing a capx so see how you're working?
B
56
S
33
G
23
Posts: 334
Reputation: 16,743

Post » Wed Sep 21, 2016 4:18 am

Image
B
64
S
23
G
7
Posts: 1,483
Reputation: 10,827

Post » Wed Sep 21, 2016 3:55 pm

DalekIx wrote:Essentially, I want a bullet that, when it comes within certain range of something else, will explode and shoot off shrapnel. I've tried using Line of Sight and Distance, but nothing seems to work.


Like this? :D

https://www.dropbox.com/s/tazwmy30op246 ... .capx?dl=0
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Wed Sep 21, 2016 7:58 pm

ultrafop wrote:I'm not sure why checking the distance wouldn't work. Would you mind sharing a capx so see how you're working?


Sure thing.

Image
B
7
S
1
Posts: 6
Reputation: 387

Post » Thu Sep 22, 2016 12:11 am

1. Your first event is not picking any Flak objects in the conditions. All Flak objects will be destroyed if any of them are within 150 of rocket.

2. In your loop, there are no Flaks to spawn shrapnel from because they all got destroyed in the previous event. In the same vein, you cannot set the properties of any shrapnel objects because none were created.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Thu Sep 22, 2016 1:34 am

oosyrag wrote:1. Your first event is not picking any Flak objects in the conditions. All Flak objects will be destroyed if any of them are within 150 of rocket.

2. In your loop, there are no Flaks to spawn shrapnel from because they all got destroyed in the previous event. In the same vein, you cannot set the properties of any shrapnel objects because none were created.


Here's the thing, the Flak Objects are passing straight through the rocket without being destroyed.

Furthermore, I've decided to try to tackle this issue in a different way: By having the Flak carry an instance variable that is the distance between the flak gun and the rocket which was targeted at the moment of firing. Then, when the flak has travelled that distance, it will explode.

I am, however, having some problems with getting the x and y of the rocket targeted at the moment of firing. How do I go about that?
B
7
S
1
Posts: 6
Reputation: 387

Post » Thu Sep 22, 2016 2:19 am

Don't use =
..should be (greater than or equal)
korbaach wrote:Image
Image
B
64
S
23
G
7
Posts: 1,483
Reputation: 10,827

Post » Sun Sep 25, 2016 3:03 am

I've gotten the shell to explode using line of sight. Turns out that I hadn't included the event sheet :roll:

Now the problem is that the shrapnel is spawning all bunched up...

Image
B
7
S
1
Posts: 6
Reputation: 387

Post » Sun Sep 25, 2016 6:55 am

Sorry for the double post, but I figured out what I was doing wrong:

I was setting the direction of movement, when I should've been setting the angle of the shrapnel objects. It works fine now.
B
7
S
1
Posts: 6
Reputation: 387


Return to How do I....?

Who is online

Users browsing this forum: ChesVCF, DarknessGamingDK and 2 guests