How do I load like 100's of files the best way?

0 favourites
  • 9 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hello.

    I am using json files of TMX importer to make levels and I use AJAX to load into game, I am loading into array. That's fine.

    But the events is not ideal to load.

    I tried to put into loop but it won't work because "On xxxx Completed" has this Green arrow meaning it can't be put into a loop. So I have now 21 indiviual "On xxxx completed" events and I have to manually add for every file I add to the project folder.

    Same thing can be said for the "Request xxxx (tag xxxx)" long list and the the name can't be part of loop/variable because of it is from a fixed list of names of the files you have in project.

    To illustrate what I mean.

    Can I streamline this a bit? Or maybe make it automated by finding all the json files in a folder and load those in ordered manner to array?

  • Save all those to a dictionary, download that as json, and load it via ajax.

  • Hmm, ok thanks I will have to dig into that.

  • just a thought..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ajax and json aside (of which i know nothing, so maybe the following makes no sense at all) rather than trigger a different event on each level finished, you could set a function:

    On any level completed ---> trigger f(x)
    /*where X is the current level's number*/
    on f(x) triggered ---> set array value X to ajax.lastData
  • Thank you.

  • korbaach

    I have used your example with some modifications and it works! Thanks.

  • Hey guys. In relation to this, how do I save other sprites' instances and their respective placements per level?

    What if I have multiple instances of a specific enemy in level 40 and 0 instances in level 1 or something?

  • Use a dictionary to store indexes/lists of level objects, with another subset for X/Y? Save in-game values found upon exiting and saving to the dictionary. Then just restore them back upon reloading the game.

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