Making Random Length Platforms

Get help using Construct 2

Post » Sun Oct 20, 2013 3:41 pm

Hi Guys,

I have been searching around but couldn't find a definite answer. How do I create a platform that's random in length with a starting and ending image?



Base on my image above, I would like to start off with the blue triangle, create random amount of red squares and end it with a green triangle.

Any help is appreciated. Thanks!
B
28
S
12
G
6
Posts: 42
Reputation: 5,504

Post » Sun Oct 20, 2013 4:24 pm

Have a look at the Template: Auto runner. They seem to use random platform length. You could just tag your start and end blocks on.

You can find the templates in Construct 2, New Project, and scroll down.

Hope that helps
B
13
S
4
Posts: 67
Reputation: 1,270

Post » Sun Oct 20, 2013 4:51 pm

let's say end pieces are 30 px wide, mid piece 10px
Call function with parameters where to start (coordinates, param 0 and 1), how many mid pieces there can be (min: param 2, max: param 3)

function "createplattform":
vwidth(localvariable) = 0
-- : create starttile at (function.param(0),function.param(1))
add 30 to vwidth

-- for 1 to floor(random(function.param(2),function.param(3)+1): create midtile at (function.param(0)+vwidth,function.param(1))
add 10 to vwidth

-- : create endtile at (function.param(0)+vwidth,function.param(1))

Just make sure that the origin point of the tile is at 0,0 of the image (not in the middle) or you get overlaps.mindfaQ2013-10-20 16:52:15
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Tue Oct 22, 2013 3:24 am

@mindfaQ

Thanks! Will give it a try.
B
28
S
12
G
6
Posts: 42
Reputation: 5,504


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests