How do I randomly spawn infinite object every 10 pixels

Get help using Construct 2

Post » Mon Oct 06, 2014 10:44 am

What I need to do is spawn a object every 80y in either one of the four x column. If you have played the game piano tiles what I am trying to do is spawn a tile every 80y up the track in either one of the 4 columns. What I need to know is the expression or event to do this so many objects spawn on the start of the layout.

Thankyou


Ps. I am not trying to remake piano tiles :/
B
8
S
3
G
2
Posts: 52
Reputation: 1,762

Post » Mon Oct 06, 2014 1:54 pm

Try using nested For loops. So for example:

For "x" from 0 to 100:
---For "y" from 0 to 100:
------Create object YourSprite at (LoopIndex("x") * YourSprite.Width, LoopIndex("y") * YourSprite.Height)

This example will create a 100 x 100 grid of sprites of an arbitrary size. You can, of course, change the loop bounds if you want more or less tiles. The expression LoopIndex(LoopName) returns where you are currently in a loop.

Let me know if that helps at all. I'll clarify points if you have any questions.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Tue Oct 07, 2014 10:46 am

all right thankyou I will try this tomorrow
B
8
S
3
G
2
Posts: 52
Reputation: 1,762

Post » Tue Oct 14, 2014 1:53 am

I misunderstood what you wanted originally, I believe. Here's an example demonstrating what I think you want:

loopTiles.capx
You do not have the required permissions to view the files attached to this post.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Tue Oct 14, 2014 10:28 am

thankyou very much
B
8
S
3
G
2
Posts: 52
Reputation: 1,762


Return to How do I....?

Who is online

Users browsing this forum: Construct Monkey, David181, luckyrawatlucky and 1 guest