Function Loop problem

0 favourites
  • 5 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • Hi again! And thanks for the "all-time" support you give to the noobs like me!

    In this case, i seek for help to find out what's going on here... ibb.co/jqk8eS

    As you see, there's a main function (Generatemap) wich is suppossed to create the map, and there's F1 and F2 wich are other functions wich pick randomly a different type of map. The idea would be that... Once the F1 or F2 reaches X>=128, it should recall the "Generatemap"... Creating a sort of "loop"... But it ain't quite working...

    Any suggestions?

    Thank you all!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you really need to give us a capx c3p but

    1) you have x less than 128 will keep calling gen map not more than 128

    2) i dont see x being set or added to anywhere

  • Hey! Thanks for the answer!

    I just uploaded the capx if you wanna check it out...

    ufile.io/2v067

    About the X being set... I believe i did set it, when i created the object... You're supposed to give it a layer, X and Y.

    So i really don't know...

    BTW, should i destroy the object later?... To save RAM? or... just leave it there?

    I'm sorry, i don't think i understood this: "1) you have x less than 128 will keep calling gen map not more than 128"?...

    Thanks in advance!

    Getting into this thing

  • OK man I can see you are making a infinite runner with random platforms but there are a lot of issues with your events

    for a start you are calling F1 from inside itself, which you can do at a more advanced level, but this is not what you want to do here

    you need to at least call it once from outside

    so move

    platforms x < 128 call "F1" outside the function

    however this causes another issue that as long as platforms x less than 128 it will keep calling the function to make more map every tick for ever as platforms x is gone off screen for ever.

    you could set platforms x back to 0 or whatever it was at the start but you have just created more platforms with the F1 function so now the old and new platforms will overlap

    so.... yea. i dont no how to make infinite runner but there are lots of template and examples here and on youtube and possibly in your C2 examples folder. Have a look at those for ideas.

  • Hey! I had a REAAAALLY loong week at work, so i just got the chance to get in here!

    And yeah... That's exactly what i got... Once X>128, the platforms start to overlap bc of "every tick"...

    It's ok bro! I'll make sure to look for some template or something!

    Thanks for your time!

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