How do I make a simple flashcard program?

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I am trying to learn French so I have created an Excel file with about a thousand rows of French words and phrases, along with the English translations. I have exported the file to .csv and it looks like this:

    [ID,French,English]1,Je m'appelle,My name is
    2,Tu t'appelles,Your name is (informal)
    3,Il s'appelle,His name is
    [/code:2lu9b3tr]
    
    How do I get this data into my Array object?  
    
    I added the .CSV to my Project files and I've successfully read it using AJAX.  Should I use a "For" loop and "tokenat" to parse it into the Array (using "Insert")?  It seems like Construct 2 prefers .json files so maybe I should just convert the Excel file to .json and read it into the array that way?
    
    What's the best approach here?  Any thoughts or suggestions will be appreciated!
  • If you're willing to use third party extensions, rexrainbow made a plugin to do just this.

  • Thanks for the reply. I was looking at the CSV2Array plugin as I thought it would let me download a CSV and add the data to an Array. But I don't think it works like that; I apparently have to copy my data and paste it into a small field. I have 1000 rows of words and sentences, and I wasn't sure if it would accept that much data. Do you know?

    UPDATE: I just tried to convert my data to .json but the array feature "download json" doesn't do what I thought it did. Back to square one. Maybe my first approach is still the best.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply. I was looking at the CSV2Array plugin as I thought it would let me download a CSV and add the data to an Array. But I don't think it works like that; I apparently have to copy my data and paste it into a small field. I have 1000 rows of words and sentences, and I wasn't sure if it would accept that much data. Do you know?

    UPDATE: I just tried to convert my data to .json but the array feature "download json" doesn't do what I thought it did. Back to square one. Maybe my first approach is still the best.

    As far as I know, you can request the csv file with ajax and use tha ajax.lastdata with csvtoarray to fill the array with the csv-data.

  • UPDATE: I wrote some VBA code in Excel to export my spreadsheet into C2's .json format. I made this a Project File and then used "AJAX.LastData" to "LOAD" the file into my array. Works great!

    NEW QUESTIONS:

    I want to make my web app available to my wife and other people in my French class. Ideally, the app will keep track of which words/phrases they get right and wrong so I can make the latter come up more often. I'll also need to add new words/phrases to the list by updating the .json file on the server.

    What would be the best way to do this? Here's what I am currently considering:

    PHRASES ARRAY:

    [id] = Sequential numbering from 1 to the total number of cards. Doesn't change.

    [french] = A French word/phrase

    [english] = The English equivalent

    [score] = This variable is used to determine how often that flashcard appears (based on whether players got it right or wrong)

    LOCALSTORAGE:

    [id]

    [score]

    Then I'll do something like this?

    1. App starts - load Phrases Array from .json file on server

    2. Load LocalStorage

    3. Copy local [score] to array [score] by using the matching [id]

    Then I'll show the Flashcards with the lowest score. If users get a card right then I'll raise the score. If they get a card wrong I'll lower the score.

    If I store my Phrases Array with the [id] first and the [score] last then I should be able to sort the array on the X axis (sort by [id]). Or, Sort the array on the Y axis and then sort it on the X axis (sort by [score]). Right?

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