How do i fix array loop after reach the end?

From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Dear Construct Forum

    I've construct a trivia game with array function, there are index deleting function so the display doesn't displaying the same question twice or more. But the problem is when the index reach the end, the text won't displaying anything, I've tried to fix this by creating an event if text = "" then the indexing function will be called back. But I am confused where to put the command line? Please help, thanks

    https://drive.google.com/file/d/1BkDwLhBxHzqP1I2wxHUAKCK8nXcm0ljb/view?usp=sharing

  • Hi,

    I've checked out your c3p file, and I think the issue is due to the fact that you're actually hardcoding all levels from 1 to 10 by copying the logic.

    I really wouldn't do that. I would make the level a variable and make functions that do the logic based on the variable. Only one set of logic instead of 10 times the same. Also, you could use dictionaries or arrays instead of txt files or you could alternatively make up the question using randomisation. For example: in the 1st level you would generate numbers between 1 and 10 and solutions between and 15. In level 2 generate numbers between 10 and 20 and solutions between 10 and 30. Something like that.

    If you want some inspiration on creating apps you can check out my youtube channel.

    There is no template for a quiz (yet) but you can see similar solutions for example

    for sudoku : youtu.be/Rq0iQGcVQtc

    for a logo quiz: youtu.be/rDKwhBwf7Ck

    Hope that helps you in some way.

  • Thank you for the recommendation, the last time I learned a programming language was about 14 years ago, and programming is not a routine in my job. I tried to use constructs to make educational games for my elementary school students who have difficulty learning in the current pandemic conditions. I will study your video later.

    I am also making an educational platformer game as a side project to this one game.

  • Try Construct 3

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

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

    I've checked out your c3p file, and I think the issue is due to the fact that you're actually hardcoding all levels from 1 to 10 by copying the logic.

    I really wouldn't do that. I would make the level a variable and make functions that do the logic based on the variable. Only one set of logic instead of 10 times the same. Also, you could use dictionaries or arrays instead of txt files or you could alternatively make up the question using randomisation. For example: in the 1st level you would generate numbers between 1 and 10 and solutions between and 15. In level 2 generate numbers between 10 and 20 and solutions between 10 and 30. Something like that.

    If you want some inspiration on creating apps you can check out my youtube channel.

    There is no template for a quiz (yet) but you can see similar solutions for example

    for sudoku : youtu.be/Rq0iQGcVQtc

    for a logo quiz: youtu.be/rDKwhBwf7Ck

    Hope that helps you in some way.

    Can i replace the value if its zero?

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