CloveltOc's Forum Posts

  • > Yup! Just saying that being able to load only one file at a time is quite a bummer

    >

    Mmm... that is not 100% correct.

    You can REQUEST multiple files and inside "On complete" AJAX.LastData refers only to the data loaded in the tag defined at your "On complete" event.

    Yeah, that's what I meant, only one files' lastdata at a time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Three types:

    > I need all of this data to be accesible without loading and unloading files with AJAX (not instant, sadly), that's why I copy them into arrays

    >

    It's not a "game" or "Construct" thing, It's web technology. AJAX is the way to access external files.

    Yup! Just saying that being able to load only one file at a time is quite a bummer

  • A "better way" is not to load those values from external files, but internal vars/arrays/dictionaries. You can have a configuration event sheet where you'll edit your values directly in C2. This way you will not need json, xml, or any other format but C2 conditions or actions.

    The answer you are looking for is: "it is internal or external", there is no other way.

    Hmmm, had not considered setting values manually onto array objects on a separate event sheet... Tedious, but clean and maybe not to annoying to edit? Still, editing from a text editor is more convinient for lots of values

    Would still like to know R0J0hound's opinion on this, though.

  • Three types:

    -Lists (names, dialog...). Used to pick a random index

    -Weapon parameters (10+ per weapon, lots of weapons). Used to pick current weapon parameters

    -Font kerning values

    All of these are in separate .txt's

    I need all of this data to be accesible without loading and unloading files with AJAX (not instant, sadly), that's why I copy them into arrays

  • 2. I don't understand your problem. Better solution for what?

    I have to use AJAX plus external files just to have arrays loaded with parameters, as reading directly from AJAX.lastdata would mean loading a file each time (not instant). A better way of handling this, is what I meant.

  • Wouldn't it lag? I've heard that loading big strings using that action causes freezing

  • Shameless bump...

  • Objective: (on start, happens once) fill arrays with predetermined data (names, parameters...) before the game starts. I want to be able to easily modify it.

    What I'm doing right now:

    I read each .txt (which is basically a construct array in .json) with AJAX, then copy all data with for loops into each array, so I can then do things like generating a name choosing randomly from the array. I can have each .txt in a text editor open, edit a value then save it and preview.

    I know there is a JSON/XML plugin and I've seen others do things like pasting array .json code directly into an action to load an array (which is said to be dangerous for framerate) or set each cell manually with actions in the event sheet.

    Is there a better/simpler solution?

  • Thanks, I guess I'll redo some of the code to support "on complete"

  • Hey guys, I've been concerned lately and would really appreciate if someone could clear something up:

    I'm using AJAX to load an array (many, MANY values) from a .json file into an array object once. I also load the kerning of a custom font with it, so I'm not worried right now, but I think I'll be using this plugin for other purposes with several files in the future, loading at any time (dialog, etc...)

    So the thing is: keeping in mind that loading a file isn't instant, will the expression AJAX.lastdata be conflicted when constantly loading different files?

    Should I make loading a file a function that gives a signal when finished to be sure, or am I ovethinking this?

    Or should I just load everything from one file (by using tokenat)? Would it be cpu-expensive?

    In the end, everything ends up in arrays so, is there a hacky alternative to have loaded array objects from the beginning without using AJAX (maybe by tampering with the project files)?

    Any help/info is appreciated.

  • Shameless bump

  • Don't have Spritefont+, could you make a vanilla .capx if possible?

  • Whoops, totally made move towards position up. Sorry!

    Move at angle will serve the exact same purpose, just put angle() instead of distance()

    Jeez, not feeling bright today

  • Move towards position is the action's name

    Position and distance are just parameters of said action

    Distance is how many pixels they will move each time the action is triggered

  • for each star

    if powerup is enabled

    and

    if distance(ball.x,ball.y,star.x,star.y) is greater than (300)

    -(star)move towards position (ball.x,ball.y) distance -20/20 or whatever