How do I Create this type of randomness

Get help using Construct 2

Post » Tue Jun 28, 2016 7:41 am

Hi
I want to create random pipes like in image
I know how to create random
but i don't know how to create this type of randomness
gap is same as width of pipe and pipe should come randomly like 1, 2,3, 4, 5, 6 but gap should be 1 pipe
How to create this

Image

https://www.dropbox.com/s/gi6kndrh8bfpw ... e.jpg?dl=0
Last edited by luckyrawatlucky on Tue Jun 28, 2016 8:36 am, edited 1 time in total.
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Tue Jun 28, 2016 8:17 am

your images are broken
B
11
S
4
G
5
Posts: 73
Reputation: 3,431

Post » Tue Jun 28, 2016 8:35 am

realMantis wrote:your images are broken

https://www.dropbox.com/s/gi6kndrh8bfpw ... e.jpg?dl=0
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Tue Jun 28, 2016 9:03 am

B
21
S
3
Posts: 73
Reputation: 1,488

Post » Tue Jun 28, 2016 9:24 am


Hi
thanks for this
It is helpful but pipes are limited
pipes should come continuously
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Tue Jun 28, 2016 9:58 am

Easy, add value "count" to each pipe set, and when player jump on set=6 add for example set 9 (2,3 or 4 set forward), then move everything so all can fit in your layout (only background dont move)
B
21
S
3
Posts: 73
Reputation: 1,488

Post » Tue Jun 28, 2016 10:06 am

Thanks I'll test it
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Tue Jun 28, 2016 10:08 am

You could make two index variables (Index and Skipped) and create a random number between 0-1.

if 0 no pipe will spawn and Skipped+1and Index+1
if 1 pipe spawns and Index+1

spawn pipe at:
X = pipe.width*index and Y = BottemOfLayout-pipe.width*(index-skipped)

EDIT: Sry made a mistake, this one works better
B
11
S
4
G
5
Posts: 73
Reputation: 3,431

Post » Tue Jun 28, 2016 10:12 am

@RealMantis
I only know about variable & I don't know anything about index variable
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Tue Jun 28, 2016 10:19 am

luckyrawatlucky wrote:@RealMantis
I only know about variable & I don't know anything about index variable

Sry :D create a variable with value of 0
B
11
S
4
G
5
Posts: 73
Reputation: 3,431

Next

Return to How do I....?

Who is online

Users browsing this forum: FlyingRam, jkmalau, marcinkowski and 9 guests