Importin images as URL in a XML or CSV file

0 favourites
  • 9 posts
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • Hello everyone,

    I'm creating a memory matching game for kids using many different images.

    The problem is that I need to randomly pick card images from an online png database and make them appear as cards at startup. Moreover, the file giving the image's URL has to be easily to modify because someone else will update the image databse once i've finished the game.

    I've tried to append the image's URL using the AJAX, XML and CSV plugins (and also the URL to Image plugin) but I cant get it to work properly, mainly because importing files with ajax is more complicated than I thought.

    What do you guys think about this ?

    Should I use AJAX and XML/CSV ? Should I use an array to stock the URL strings ?

    I'm quite lost now that I've seen the many tutorials on Scirra and Stack Overflow forums : it seems that there are many methods to use a database-like file in Construct 2 and I dont know wich one would be the more optimized for images (and easy to manage).

    Any ideas ?

  • I know what happened : the line "standalone" _in the XML was blocking the parsing.

    Now I just have to find a way to transfer the data from the XML to an array and to append the urls from the array to a sprite.

    That won't be too difficult I hope !

  • Hey Shapter !

    How did you get on with this project? I'm trying to do a similar thing. (pulling image's from a database and into a game)

  • Hey Necrokrieg,

    It worked quite well using the Ajax, Xml and array plugins.

    Requested a XML file from dropbox public folder, stored the content of the XML in an array using "for each node" loops (found in the xml plugin) and then loaded images in each objects (cards sprites) usin "for each node" loops once again.

    Here's the code :

    https://drive.google.com/file/d/0B-727M6ikDE_dmVLazNicFBCOVU/edit?usp=sharing

    https://drive.google.com/file/d/0B-727M6ikDE_Nk41T21IazY5TDA/edit?usp=sharing

    The URL in ajax is PickedLevelUrl because the previous menu was also importing stuff, so in your case it should be a regular URL.

    The only problem was the speed of the wifi while importing the images : I had to build a loading screen and the game wouldnt work if the bandwith was too low ...

    I'm no programmer so I dont know if it's a nice and tidy way to do this ! :D

    May I ask why are you working on ?

  • oh wow! Good Stuff Shapter

    (Sorry for the late response you didn't notify me with an )

    I'm trying to make a basic 'Look Up' app.

    You type in a character's name and their stats will appear along with an image loaded from a URL that's stored in an XML file or CVS spreadsheet.

    I like Mortal Kombat BUT always forget the moves so I thought I could type in a character's name to bring up their combos!

    Iv made a super primitive version, without XML, etc. Capx

    I'm going to go through your event sheet, very helpful!

    btw I love your game concept "Agents of a Corporate Empire" It reminds me of

    Subscribe to Construct videos now

    , love that game. It looks great.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey NECROKRIEG !

    Quite a good idea you have there, making an app displaying the moves from a combat game ! It's a good way to keep the players connected to the game even if they're not playing at the moment, like when you play with more than two friends at a time.

    The process with loops is quite straightfoward in C2 but be mindful if you want to export as something else than a browser based app : for example CocoonJS doesnt support the XML plugin.

    I just saw that we can use crosswalk to keep any browser based features while making kind of an .apk app :

    scirra.com/tutorials/809/how-to-export-to-android-with-crosswalk

    I'll look into your capx as soon as I 've dowloaded the new version of C2.

    And thanks for Agents of a Corporate Empire ! It's my main project for the moment and I have to confess that Papers Please was one of my main inspiration, with the movie posters from Saul Bass.

  • Shapter ooh thanks for the xml compatibility advice! That's a good idea; releasing a combat app for an established game. It does connect the player more to the game when they can't play. I guess GTA5 did this with their mini game app.

    I did another doodle using the CSV plugin instead of using the Xml plugin. It loads images from URLs. The url links are stored in the CSV plugon. Might be useful. Csv Capx

    Love a bit of Saul Bass. Check some of this art out. Music & Cover Art

    <img src="http://31.media.tumblr.com/9918dff8541624f6f0b9a12d969eb135/tumblr_mkfkb40f7L1s0d8ndo1_1280.png" border="0">

  • Now that's my kind of art ! Kind of a weird mix between christian/WH40K/Tim Burton imagery :D

    As for the CSV plugin you might want to check if it is compatible with mobile exporters, as it is a third party plugin (made by the community I think).

    Also you can import a .CSV file made in excel as a project file from wich you can transfer data to your array (I've never tried it but it seems quite easy).

  • Hey Necrokrieg,

    It worked quite well using the Ajax, Xml and array plugins.

    Requested a XML file from dropbox public folder, stored the content of the XML in an array using "for each node" loops (found in the xml plugin) and then loaded images in each objects (cards sprites) usin "for each node" loops once again.

    Here's the code :

    https://drive.google.com/file/d/0B-727M ... sp=sharing

    https://drive.google.com/file/d/0B-727M ... sp=sharing

    The URL in ajax is PickedLevelUrl because the previous menu was also importing stuff, so in your case it should be a regular URL.

    The only problem was the speed of the wifi while importing the images : I had to build a loading screen and the game wouldnt work if the bandwith was too low ...

    I'm no programmer so I dont know if it's a nice and tidy way to do this ! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    May I ask why are you working on ?Shapter2013-12-28 16:44:15

    Hi Shapter, is it possible to re-upload these examples? I am hoping it can help me understand to get images into my xml files / xls files in c2. Thanks,

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