How do I create obstacles on runner platforms when created

Get help using Construct 2

Post » Mon Aug 11, 2014 3:56 pm

hi guys

im following the construct 2 runner template and i want to generate some obstacle blocks when the platforms are created.....

So i need something like

every int(random(4,8)) seconds ---> create "Spikes" on top of the platform

Also these spikes should be not only in the middle but if the platform where to be 500 pixels, it should be between 100 and 400 so it won't fall on the edge of the platform


Thanks for the support
B
7
S
2
Posts: 57
Reputation: 591

Post » Tue Aug 12, 2014 7:36 am

Her is a example hope it helps.
You do not have the required permissions to view the files attached to this post.
B
13
S
3
G
1
Posts: 36
Reputation: 908

Post » Tue Aug 12, 2014 11:38 am

Sorry i forgot to clarify something, the platforms are tiled BG's

Is there a way to create random platforms (like in the runner example) without beign tiled BG's ? then putting tiled bg's on top of it...
B
7
S
2
Posts: 57
Reputation: 591

Post » Tue Aug 12, 2014 12:05 pm

Everything is possible, but I'm not quite sure what you want to do..

on platform created you should check the width of the platform
if the platform is more than 200 in width create a random function to put or not put spikes on it..

so something like this:

on platform created
system compare two values: platform.width > 200
- call function "Spikes" with parameter 0=choose(0,1) ,parameter 1=platform.x ,parameter 2=platform.width , parameter 3=platform.y

on function "Spikes"
compare function parameter function.param(0) = 1
- create object spikes at x=random(function.param(1)+100,function.param(1)+function.param(2)-100) y=function.param(3)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Aug 12, 2014 12:10 pm

Thank you Sir! i will try what you posted...

I guess that i could do something easier like

If bgtile width => than 200px
Create Item on bgtile bbtop ?
B
7
S
2
Posts: 57
Reputation: 591

Post » Tue Aug 12, 2014 12:13 pm

I just added a randomness to it and made sure the spike wasn't created on the first 100 and last 100 pixels of the bgtile, because that was what you asked..

Oh, and you should probably pin the spikes to the platform with the pin behaviour for them to move with the platform..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Aug 12, 2014 12:36 pm

I just tried the formula and it worked perfectly!

Thank you LittleStain! good luck :D
B
7
S
2
Posts: 57
Reputation: 591

Post » Wed Dec 02, 2015 4:44 pm

Message: desasteraang is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
@LittleStain, i tried your formula and its not working....what am i doing wrong?
B
6
Posts: 43
Reputation: 342

Post » Wed Dec 02, 2015 4:49 pm

desasteraang wrote:@LittleStain, i tried your formula and its not working....what am i doing wrong?


I can't see your link, because of forum restrictions..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Dec 02, 2015 11:57 pm

aww man...i need to get my rep to 300 before i can post any links
B
6
Posts: 43
Reputation: 342

Next

Return to How do I....?

Who is online

Users browsing this forum: MiloMasson, Yahoo [Bot] and 30 guests