How do I make a random line

Get help using Construct 2

Post » Thu Oct 30, 2014 10:50 pm

So I want to make a random line, that always goes up (never goes down again). If you have any idea how I can simply do that, that would be nice. I want my sprite to always stay ontop of that line if he falls off; its game over.

I decided to spawn my sprite everyime my previous sprite.Y was equal to 0 and then do that over and over again so it would eventually be an infinite random line, also everytime it spawned the line would turn a little around it axis, so to keep the line "not straight". The "line" is actually a rounded rectangle and I'm trying to create the illusion so that when they spawn on eachother it looks like a straight line.

My problem is everyway I try this, the line stops after 1 spawn or never spawns at all.
I included a sketch, to try and make this clearer, I hope you can read my handwriting :D

(if you have problems viewing the picture try this link then: http://imgur.com/s0nHDfe )
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 8
Reputation: 218

Post » Thu Oct 30, 2014 11:28 pm

Something like this ?
You do not have the required permissions to view the files attached to this post.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Fri Oct 31, 2014 7:37 am

Coin-coin le Canapin wrote:Something like this ?


I adjusted the capx a bit so you could see what I mean.

The line needs to go down, I can do that but that means it should always keep spawning another sprite when going down. I could ofcourse adjust the i variable to 1 million, but that would need to much processing power. and it wouldn't exactly be infinite
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 8
Reputation: 218

Post » Fri Oct 31, 2014 9:22 pm

I'm pretty sure there is a nicer way to do it, but it works :)
It also prevents the sprites to go outside the window on the left and right.

Edit : sorry, I updaded the wrong file, here is the new and working one !
You do not have the required permissions to view the files attached to this post.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, fens, rayolf and 23 guests