How do I create obstacles on runner platforms when created

0 favourites
From the Asset Store
Obstacle Impacts and Cartoon voices, will makes your game more funny!
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Her is a example hope it helps.

  • 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...

  • 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)
  • 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 ?

  • 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 just tried the formula and it worked perfectly!

    Thank you LittleStain! good luck

  • LittleStain, i tried your formula and its not working....what am i doing wrong?

  • LittleStain, i tried your formula and its not working....what am i doing wrong?

    I can't see your link, because of forum restrictions..

  • aww man...i need to get my rep to 300 before i can post any links

  • You can post links by adding spaces like this:

    https : / / onedrive.live.com/

  • Thx for the info

    http: / / postimg.org / image / ocm7u0emz /

  • better yet...heres my capx file LittleStain

    http : / / bit.ly / 1LPpvs6

  • Can't open your capx, because you use plugins I don't use and have..

    Seems to me from your image you are not picking the right block, at least in the funtion itself it's not clear, but I'm also not sure if the condition that calls the function has a reference to the correct block..

  • ok heres the capx without the plugins LittleStain

    http: / / bit.ly / 1LPpvs6

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)