Randomized "SpiderWeb" effect

Get help using Construct 2

Post » Thu Sep 28, 2017 2:20 pm

Basically I want to create particles, all of which have 1 STRAND CONNECTED TO EVERY OTHER PARTICLE on the screen to give that "spiderweb" effect for some trippy background effects.

https://www.dropbox.com/s/om6il8989vxe6 ... .capx?dl=0

I kind of the get idea up to a certain point. As you can see in my capx, I have no problems with spawning the initial particles and respective strands but I have trouble with the next few ones

I'm thinking something like:

For X particle spawned > particle(loopindex) spawn 1 Joint
repeat particle.count-loopindex times
Now my problem is actually getting these spawned lines to connect with to the right opposing particle.

How do I accomplish this? :)
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,246

Post » Thu Sep 28, 2017 2:46 pm

Like this?
Image
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
69
Posts: 1,048
Reputation: 37,659

Post » Thu Sep 28, 2017 3:08 pm

dop2000 wrote:Like this?

Yes. Like that.
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,246

Post » Thu Sep 28, 2017 3:09 pm

Here you go...

https://www.dropbox.com/s/j0f5ti8dvz56c ... .capx?dl=0

I reduced the number from 80, because it seemed toooooo much. But you can just put whatever you need there. :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
21
S
6
G
3
Posts: 659
Reputation: 3,845

Post » Thu Sep 28, 2017 3:10 pm

Thanks! :D
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,246

Post » Thu Sep 28, 2017 3:16 pm

Arr, brunopalermo beat me again!

https://www.dropbox.com/s/mnxh1a0l00rkg07/web.capx?dl=0

Edit: Actually @brunopalermo , are you aware that in your example thousands of lines are created every second? :)
Last edited by dop2000 on Thu Sep 28, 2017 3:22 pm, edited 1 time in total.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
69
Posts: 1,048
Reputation: 37,659

Post » Thu Sep 28, 2017 3:20 pm

brunopalermo wrote:Here you go...

https://www.dropbox.com/s/j0f5ti8dvz56c ... .capx?dl=0

I reduced the number from 80, because it seemed toooooo much. But you can just put whatever you need there. :)

This one actually has unlimited spawning strands but I put it under "TriggerOnce" and it's good. Thanks!
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,246

Post » Thu Sep 28, 2017 3:25 pm

Even with "Trigger once" it makes too many lines - 10 lines for 3 particles.
Mine makes 3 :)
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
69
Posts: 1,048
Reputation: 37,659

Post » Thu Sep 28, 2017 4:56 pm

Yeah. I didn't implement it to check the "going back" lines.

For instance, if you have 3 particles A, B and C, there are 3 lines: AB, AC and BC. In my implementation it will create AB, AC, BA (which is, essentialy AB backwards), BC, CA (again, AC) and CB (again, BC). The idea was just to show you how to go with the lines. You should treat the code to skip already drawn lines...

EDIT: in fact, I think it is even drawing lines towards themselves...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
21
S
6
G
3
Posts: 659
Reputation: 3,845

Post » Thu Sep 28, 2017 5:01 pm

brunopalermo wrote:Yeah. I didn't implement it to check the "going back" lines.

For instance, if you have 3 particles A, B and C, there are 3 lines: AB, AC and BC. In my implementation it will create AB, AC, BA (which is, essentialy AB backwards), BC, CA (again, AC) and CB (again, BC). The idea was just to show you how to go with the lines. You should treat the code to skip already drawn lines...

EDIT: in fact, I think it is even drawing lines towards themselves...

Finally got it to work. Used loopindex("this") for starting point of loopindex("target")
Looks great and according to particle.count it's right. Thanks again. :D
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,246

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests