Construct 2 + XML?

0 favourites
  • 3 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi,

    Is it possible to use XML with construct 2 to store information?

    For example I need to do a game where kids need to match images to the right place. My idea was to have more than one image for each position, so that only one of them (randomly) was loaded each time the game started, in order to have differente sets of images every time.

    I imagine I can put them all in the project in an array, or something, but the problem would be that they all had to be loaded I guess. So if it was possible to select images from a XML database these would be loaded only when they were requested.

    Also these images need to have some related text, so my idea was to have a XML file with links to the images and respective text and then import them from there each time the game started.

    Thanks

    Fil

  • Hi fil.

    There are several ways to approach your issue.

    You can store every images as part of the animation of a sprite.

    Set the animation speed to 0, now you can use the sprite as an "image bank", randomly chosing the animation frame to display.

    As you said, it needs to load all images first (on load of the application to be exact) but using image compression in C2 you could load up a fair deal of images and still have a reasonable download size at the end.

    From there you can use an array object and set a sentence to correspond with the frame number in the sprite.

    There's no built-in way to load images at runtime, they must be loaded in the IDE on edittime.

    But you could use the third-party plugin way.

    You could try Load image from url at runtime or yet the CSV plugin.

    Check the list of custom behaviors and plugins and see if you'd find something that fit your needs.

  • Try Construct 3

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

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

    Thanks a lot for your help.

    Thats a good idea to use the sprite animation as a data bank. :)

    It did took some time for me to find how to change the animation speed, but I have finally found it.

    I think I am going to keep things as simple as possible for now, until I get more used to using construct. So I'll just design the game with a small number of images and then when I have the basic stuff working I will try using the plug-ins to have more options. Thanks for pointing me in that direction, though.

    Fil

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