How do I create a database with picture and text, and...

0 favourites
  • 7 posts
From the Asset Store
OpenAI TTS
$9 USD
10% off
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • Hello.

    Im on construct 2 since 2 month, and i have one questions.

    Its possible to create a database with picture and text, and display random on the screen ??

    For example :

    IN THE SQUARE ITS A RANDOM IMAGE IN DATABASE

    Thanks in advance

  • Yes it is possible. It depends which platform you are developing for, as to the best way to do something like this.

    If you are making the project for PC, then you can use NWjs and simply pick files from a folder at random to display - whether they're text or pictures.

    If you are making this for mobile then you can use other methods, like loading the images from a URL perhaps - of it your images are embedded in the project you can just make them all in one sprite object as animation frames, then set the animation frames randomly.

    IT also depends what you mean by "database". The way data structure is typically/easily done in Construct 2 is via JSON, but you can do any way you like depending on your ability. I have made database structure will token delimited plain text, as well as JSON, as well as nested dictionary JSON. It really just depends how you want to make it work

    ~Sol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh nice, thanks your for your hellping !

  • I have made database structure will token delimited plain text, as well as JSON, as well as nested dictionary JSON. It really just depends how you want to make it work

    ~Sol

    Could you please show/tell how you used JSON within C2? Is there a plugin or something? I am currently storing my level up information in XML, which worked fine on XDK exported games. But when I switched to CocconIO , it doesnt seem to support XML at al

  • SamRock I used nwjs for this. I believe webstorage/localstorage can also do the same. Just set a global variable to your json string and use it as an expression in your save/load structure

    ~Sol

  • SamRock I used nwjs for this. I believe webstorage/localstorage can also do the same. Just set a global variable to your json string and use it as an expression in your save/load structure

    ~Sol

    Sorry bit weak on the JSON part. Would really appreciate if you could share some sample code

  • THIS TUTORIAL may help.

    Getting a JSON string from an array or dictionary is an object expression used in the action portion of your event. You will typically want to save or load values for an object, or paths to things... JSON data is specific to these objects, but your use of it isn't limited. You can store any information from any object you wish (however you want to define it) and export the data from the array or dictionary as JSON. You then use NWjs or localstorage depending on your target platform to save the JSON string as a file.

    In your original question you want to have random images appear and some random text... it's up to you how you define how those work. You can have NWjs count the number of files in the directory, and use a random number in that range to show your image. You will need to come up with a naming structure or other means of easily recalling your images (eg. image01, image02, image03; etc)

    Your text could be stored in a single dictionary, and even your folder path to images (or however you're thinking of doing it).

    I can't really provide you with an example because you still haven't mentioned which release platform you are wanting to use. It would help if I knew if it was for PC or mobile device/website. I know a lot more about using NWjs (PC) than I do about localstorage.

    ~Sol

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