QuincyDK's Recent Forum Activity

  • Well basically it's for an prototype of a media application. We store data (text, filename if relevant, filepath if relevant and info like that) into an json. That's the reason why we want to import json files into our project, to follow our data structure.

    However, are multidimensional arrays within the scope of C2 Json?

  • So basically I'm stuck with an 0-index-based aray? If so, could I just create variables and populate them by using the 0-based index of the aray?

  • Ah, okay * goes to work *

    Thank you

  • here is my text.capx file. The JSON has a data structure comparable (or actually directly ripped from) to our project.

  • And here is an example on how to download an array as a json file, and how to load an array from a json project file. (the project file is empty, it's only for the events)

    Thanks alot! I think the reading goes correctly now Problem number 2, parsing it.

    RIght now I have (built alongside your example:

    EVENT SHEET {

    1. SYSTEM | On start of layout [ AJAX | Request testing.json (tag JSON)]

    2. AJAX | On "JSON" completed [ Array | Load from JSON string AJAX.LastData ]

    3. MOUSE | On Left button Clicked on [T] Text [Text2 | Set test tp Array.At(0) ]

    I guess you can see what I try to do here. If user clicks on text2, I want the text to change to the first key in the array. Ofcourse, since I'm such a noob at C2, this doesn't work :') *ashamed*

  • QuincyDK

    i'm not sure I follow entirely what you want but here is my take on it.

    If you need to populate an array based on a JSON you build outside of C2, there are 2 ways :

    - if you want to load the JSON during runtime, you could have the JSON file in the project files, and just replace it on your server. Use an event "On start of layout : AJAX load project file myJSON.json" and another "AJAX on finished loaded : Array.loadFromJSON(AJAX.LastData)"

    - if you want to populate the array before the runtime (so inside the C2 editor), just add an event "on start of layout : Array.loadFromJSON(X)", where X is the string representing the JSON content (in one line of course).

    If you need to have the format of an Array JSON representation in C2, just do some Alert or console.log of a populated array during any runtime, and copy paste its "asJson" expression.

    I hope this was what you were looking for, I'm not sure at all x)

    I'm terribly sorry to keep on asking, but I'm new to C2. Where would I find this AJAX object? Is AJAX a plugin or..? Also: Where could I insert raw JS (Alert(); and console.log();

  • For runtime, using the array will be easier.

    For saving/restoring purposes you can get the datas of an array object as JSON quite simply, using the expression "Array.AsJSON". Then, you have to use this JSON. As it's for a back-end dev, I would suggest sending it via AJAX.

    Something like this.

    I can't deny that this is very interesting and a good tip, the reading from json is more important right now as the json will be created backend. However, this is merely for a prototype thus everything will be "static". For this purpose, we'd like to read from a json file (multidimensional would be prefered) and use this in our CS2 prototype.

  • yep it can be done.

    Using either layer scale or scaling the image.

    for moving across the image you could just use system scrollto and if youd like to make it very easy on yourself there is the litetween plugin.

    Thank you! The Litetween plugin was exactly what I was looking for

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi there,

    We currently use an array for datastorage, but to follow our back-end development we'd like to use JSON files instead.

    The documentation of CS2 isn't getting me anywhere, so could anyone explain me how this all works? *is new to CS2*

  • Hi there,

    this may sound very stupid, but we are using Construct2 to prototype an web application. For this purpose, we would like to know if dynamic scaling aka the "Ken Burns effect" is possible with Construct2, either built-in or through a plugin.

    Does anybody happen to know this?

    Thank you in advance! :)

QuincyDK's avatar

QuincyDK

Member since 17 Feb, 2014

None one is following QuincyDK yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies