Construct 2 + XML?

Get help using Construct 2

Post » Tue Jan 17, 2012 12:51 pm

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
B
5
Posts: 10
Reputation: 470

Post » Tue Jan 17, 2012 1:05 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Jan 18, 2012 12:15 pm

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
B
5
Posts: 10
Reputation: 470


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, gregorysforster, onzephyr and 1 guest