cklester's Recent Forum Activity

  • Typo spotted: "Load hash table form JSON string" - "form" should be "from"

  • I played on my PC.

    Time: 138

    Hits: 158

    Miss: 20

    Score: 142200

    One suggestion: You should make things get faster sooner. Maybe it's just the modern mentality of "ramp up quickly," but the easy stuff seemed to go on for just a bit long.

    Good job!

  • mmarcati, I never see a leaderboard when the game is over. Or what I should expect?

  • I think I got it!

    Thanks. :-)

  • I've tried using the hash plugin as well, but can't get it to successfully load up a JSON file into an array for me. There might be a better way to approach this, but I'm new to C2 and don't yet know all the intricacies.

    Each key below is the name of a level of my game. Each value represents a grid (or array), from 1x1 for "Simple Tap," to 2x2 for "Four Drum Rounder."

    Ultimately, I'd like to call up a level and plot on the screen the pattern. How do I load this into C2 so I can make use of it in that way?

    Thank you!

    {
         "Simple Tap": [ [ [1] ] ],
         "Double Tap": [ [ [1],[2] ] ],
         "Triple Tap": [ [ [1],[2],[3] ] ],
         "Quad Tap": [ [ [1],[2],[3],[4] ] ],
         "Quad Tap Double Back": [ [ [1],[2],[4],[3] ] ],
         "Single Double": [ [ [1,3],[2] ] ],
         "Triple Back and Forth": [ [ [1],[2,4],[3] ] ],
         "Three Drum Intervals": [ [ [1,3],[2],[4] ] ],
         "Angled Triple": [ [ [1],[2] ], [ [3],[0] ] ],
         "Four Square Reverse": [ [ [1],[2] ], [ [3],[4] ] ],
         "Four Square Rounder": [ [ [2],[1] ], [ [3],[4] ] ]
    }
    
  • Yes, it's one large array. I'm trying to put it all into an array. (Maybe I should use a dictionary, but I didn't know if dictionaries could have arrays as their value content.)

    Maybe that's why I'm getting that message. It's telling me my JSON is not formatted properly! Thanks, ramones. I think I understand now.

    What I should use is

    {
         "c2array":true,
         "size":[11,1,1],
         "data":
              {
                   "Simple Tap": [ [ [1] ] ],
                   "Double Tap": [ [ [1],[2] ] ],
                   "Triple Tap": [ [ [1],[2],[3] ] ],
                   "Quad Tap": [ [ [1],[2],[3],[4] ] ],
                   "Quad Tap Double Back": [ [ [1],[2],[4],[3] ] ],
                   "Single Double": [ [ [1,3],[2] ] ],
                   "Triple Back and Forth": [ [ [1],[2,4],[3] ] ],
                   "Three Drum Intervals": [ [ [1,3],[2],[4] ] ],
                   "Angled Triple": [ [ [1],[2] ], [ [3],[0] ] ],
                   "Four Drum Square Reverse": [ [ [1],[2] ], [ [3],[4] ] ],
                   "Four Drum Square Rounder": [ [ [2],[1] ], [ [3],[4] ] ]
              }
    }
    

    Oddly, neither the "Array" entry nor the "AJAX" entry indicate that the format of the JSON string being loaded need be particular. It would have saved us time if the docs had said something like, "To load a JSON string, it must be in this format: { ... }" Maybe it does and I missed it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm trying to load a JSON string (from a project file) that defines the layout of various levels for my game. Here's what the level_definition.json file contains:

    {
         "Simple Tap": [ [ [1] ] ],
         "Double Tap": [ [ [1],[2] ] ],
         "Triple Tap": [ [ [1],[2],[3] ] ],
         "Quad Tap": [ [ [1],[2],[3],[4] ] ],
         "Quad Tap Double Back": [ [ [1],[2],[4],[3] ] ],
         "Single Double": [ [ [1,3],[2] ] ],
         "Triple Back and Forth": [ [ [1],[2,4],[3] ] ],
         "Three Drum Intervals": [ [ [1,3],[2],[4] ] ],
         "Angled Triple": [ [ [1],[2] ], [ [3],[0] ] ],
         "Four Drum Square Reverse": [ [ [1],[2] ], [ [3],[4] ] ],
         "Four Drum Square Rounder": [ [ [2],[1] ], [ [3],[4] ] ]
    }
    

    So, each object has a name and a layout (as an array).

    When I read it in, I get this result (appending array_Levels.AsJSON to the log of a DebugPanel window): {"c2array":true,"size":[1,1,1],"data":[[[0]]]}

    1) Is my format wrong?!

    2) If it's the correct format, can the AJAX object not import it for some reason? My guess is, it chokes on the multi-level array definition. If that's the case, how can I otherwise read this into a C2 array?

    Thank you!

cklester's avatar

cklester

Member since 23 Jul, 2012

None one is following cklester yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies