Using project files in Construct 2

Favourite 83 favourites
Tutorial written by AshleyOriginally published on 18th, June 2012 - 1 revision

Construct 2 allows you to import external files to your project. For more information, see the manual entry on Project Files. This tutorial covers some useful workflows for using project files.

Using external image files

If your project has a lot of large detailed images which add a lot to the download size, you can make your game load quicker by adding them as project files instead. That way they won't need to be downloaded before the game starts running. You can then load them at runtime using Sprite or Tiled Background's Load image from URL actions - just enter the name of the image as the URL, e.g. "mylargeimage.jpg". You know they've loaded when the On image URL loaded trigger fires as well. This means you can request large images on the start of each layout that needs them, and show some kind of "Please wait..." message until they've loaded.

Using files for third party plugins

You may have third party plugins like a video plugin that can play videos. You can add the videos or any other files the plugins can use as project files, and access them using their filename as the URL, e.g. "myvideo.ogv". This works because all project files are in the same folder when exported, so their filenames can be used as relative URLs.

Storing additional web pages with your project

You may want to have a few extra simple HTML pages stored with your project. You can import any necessary extra HTML, CSS and Javascript files to your project, and browse to them with the Browser object. Please note that folders in Construct 2's project bar are for organisation only - once exported, all files are in the same relative folder, regardless of their folder in the Project Bar.

Loading XML data

If you want to read an XML file stored with the project, import the XML file as a project file. Then you can use the AJAX object's Request project file action to download the file, and then load the result in to the XML object. The events below show how this can be done.

Using AJAX to load XML

Storing additional documents or files to download

You can store PDF documents or other files with your project, and use the Browser object to download them (open the filename as a URL in a new window).

Making level editors

Perhaps the most advanced use of project files is the ability to support your own custom level editor. This can even include user-made levels, creating a community of additional level designers for your game, and increasing its longevity!

Making a level editor is complicated, and won't be covered in full detail here. However the principle is that using the Array, Dictionary or XML objects (or some combination of them), you can store data representing an entire level. If you've designed your level editor in Construct 2, you can use Array or Dictionary's Download action to download a .json file storing the data, or simply use their AsJSON expressions to get the data as a long JSON string. Once you have a file or files representing a level, you can import them as project files, e.g. level3.json.

Once you have all your levels imported, you can load them by requesting them with the AJAX object then loading the result in to the object, similar to how is done with the XML object in the above example. Then you are ready to load the level.

The cool thing about this is you can allow for user-made levels. If a user designs a level and uploads it somewhere like, you could have a text field in your game where you enter this URL and load their level.

You can also allow yourself to change or add new levels after the game is published, without re-uploading the entire game. For example if you load a list of available levels from an XML file, you only need to upload or change a few .json files then edit the .xml file in order to add or update levels.

Don't forget project files are available during preview, and are also cached for offline use, so it's easy to test and doesn't cause any trouble for offline players either.

One last tip: you can combine multiple arrays in to a single .json file using the Dictionary object. Simply store keys in the Dictionary object which store each array as JSON data, e.g.
Set "array1" to Array1.AsJSON
Set "array2" to Array2.AsJSON
Set "array3" to Array3.AsJSON
Then you can add a few extra keys (e.g. the name of the level) and download everything as a single .json file from the Dictionary object.


Project files are a very powerful feature of Construct 2 with a lot of flexibility. It allows for a lot of interesting new capabilities, such as dynamic image loading, better support for third party plugins, convenient handling of additional pages or documents, and even making full blown level editors with support for user-made levels. There are doubtless other things you can use it for other than those listed here - post your ideas in the comments!

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.


Antylope 3,112 rep

Kewl! I better start using it now. Good idea for big images!

Tuesday, June 19, 2012 at 4:46:23 PM
JACLEMGO 7,715 rep

Hi Ashley,

Can I use the "Load image from URL" to set the animations of a Sprite?


Saturday, June 23, 2012 at 5:40:09 PM
jwjb 4,919 rep

Interesting, hope to be able to add to my games at some point.

Wednesday, August 01, 2012 at 4:54:31 AM
GamerGon 5,625 rep

Just perfect to store my levels :)

Friday, September 07, 2012 at 5:26:09 AM
fassFlash 4,377 rep

How do I make a video run? It doesn't allow me to drag it into the layout, and I can't use the video for an image for the sprites. Must I install a plugin? Installing plugins is a pain in the

Thursday, March 28, 2013 at 1:43:53 PM
jsiitb 386 rep

You can make it run using different format of videos for different browsers. Eg: For Mozilla you will need OGV format. (check out the table in [Hyperlink removed - users with less than 500 rep cannot post links] to get video format for particular browser)

Thursday, May 15, 2014 at 9:07:05 PM
jsiitb 386 rep

How do I write HTML5 Video tags in Construct 2? I want to add a Preload=auto attribute to my video embed code. Is there a way to do the same?

Thursday, May 15, 2014 at 9:08:05 PM
AndyRevenko 613 rep

Dear all, cuold you please help me:
I have array for the level scores, I need:

1) Load array
2) Change this array
3) Save this array (I do it with Array.Download)

and again and again...

I've spent two day's and untill now do not not know how to LOAD array after saving it!!!

Sunday, February 05, 2017 at 8:56:04 PM
antares330 5,079 rep


Figured it out! Thanks to the info here :)

Saturday, November 11, 2017 at 3:37:58 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.