How do I write my own spawn system with for loops ?

Get help using Construct 2

Post » Sun May 22, 2016 1:50 pm

Dear community,

I am looking for a way to create a grid of objects, for example a 10 by 10 square consisting of the same object(sprite).
I know there is a way to write your own scripts but how can I use this in my current project ?
How do you do that, how do you add your own javascript in construct 2 ?

Very kind regards ,
Cedric
B
9
S
2
G
2
Posts: 24
Reputation: 1,675

Post » Sun May 22, 2016 1:54 pm

You can do this easily with events !

ex:
system--->For "y"=1 to 10 system---> create sprite on layer 1 at loopindex("x")*32,loopindex("y")*32
system--->For "x"=1 to 10
Last edited by granpa on Sun May 22, 2016 2:07 pm, edited 1 time in total.
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sun May 22, 2016 2:06 pm

@granpa, how then ? I cant figure out the for loop in the events sheet
B
9
S
2
G
2
Posts: 24
Reputation: 1,675

Post » Sun May 22, 2016 2:08 pm

I edited my post
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sun May 22, 2016 2:08 pm

thank you I'll try it now :P
B
9
S
2
G
2
Posts: 24
Reputation: 1,675

Post » Sun May 22, 2016 3:13 pm

that was the perfect solution :P thank you very much
B
9
S
2
G
2
Posts: 24
Reputation: 1,675

Post » Sun May 22, 2016 3:18 pm

Your welcome . glad I could help , you could also use this system to add a border around a grid of objects .
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sun May 22, 2016 3:20 pm

my idea is that if my square sprite hits a barrier or something it just collapses in these smaller squares
B
9
S
2
G
2
Posts: 24
Reputation: 1,675


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Unconnected, Waltuo, Yahoo [Bot] and 18 guests