HUYA's Forum Posts

  • 5 posts
  • Hey everyone,

    I'm currently stuck with a JSON problem I can't solve. I want to add a new element into this existing JSON file, but I am struggling to recreate the JSON structure within C3.

    It's for a quiz game, the JSON file stores all the questions and I am trying to create a question editor, where I can enter new question and add them to the JSON file.

    Here's what I did so far:

    1. I created a Dictionary with the keys:

    id, question, answersArray, wrongAnswersArray, hint

    2. Grabbed some data from Input Fields and added to the Dictionary

    3. Set some data for the arrays and added the array.AsJSON as Value in the Dictionary

    My Template JSON

    { "questions": [ { "id": "0", "question": "What is that?", "answersArray": [ "answer1", "answer2" ], "wrongAnswersArray": [ "wrongAnswer1", "wrongAnswer2" ], "hint": "Lorem ipsum" }, { "id": "1", "question": "What is this?", "answersArray": [ "answer1", "answer2" ], "wrongAnswersArray": [ "wrongAnswer1", "wrongAnswer2" ], "hint": "Lorem ipsum" }, { "id": "2", "question": "What is not true?", "answersArray": [ "answer1", "answer2" ], "wrongAnswersArray": [ "wrongAnswer1", "wrongAnswer2" ], "hint": "Lorem ipsum" } ] }

    C3 Output when I log the Dictionary.AsJSON

    { "c2dictionary": true, "data": { "id": 123, "question": "What is red?", "answersArray": "{\"c2array\":true,\"size\":[1,1,1],\"data\":[[[\"Fire\"]]]}", "wrongAnswersArray": "{\"c2array\":true,\"size\":[3,1,1],\"data\":[[[\"Sea\"]],[[\"Honey\"]],[[\"Cloud\"]]]}", "hint": "It is hot." } }

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, since yesterday I'm working on a little multiplayer game. Simultaneously I followed your "multiplayer game expample".

    My remote preview tests on different devices went fine. But today I am not able to connect to any host with my second device. Not event when I remote preview your "multipalyer game example".

    Do you have some ideas how to approach this problem?

  • Hello everyone,

    I have a problem with my level selection.

    I have a game with 3 levels, separated in 3 layouts.

    And each level has 3 difficulties.

    I built the difficulties on different layers in the layouts. (EasyLayer, MediumLayer, HardLayer)

    What I want to do now when starting a Layout:

    • Check which difficulty was selected.
    • Set the chosen "DifficultyLayer" visible.
    • Delete all objects on the other layers, because the colliders affect the player, even if the layer is set to invisible.

    Thanks for a new perspective... @

  • "on any touch start" solved all my problems! Let the button mashing begin!

    Thanks mindfaQ and all others for their responses!

  • Hi guys,

    i am working on some kind of rhythm game, where you have to push buttons in a defined pattern.

    I want it to work on Desktop Browsers and on Mobile.

    I made some tests for button mashing, just to test how often the button press is registered.

    Adding the value "1" to a visible score.

    Keyboard input works great and very fast.

    But on my iPhone, the "on tap gesture" behaves strange.

    I can register a lot inputs when I do not press on the same spot on the screen, like with both thumbs by turns on the left and right side of the screen.

    When I tap very often on the same spot, it sometimes misses an input.

    Is there a solution to make this work?

    Thanks!

  • 5 posts