Creating a .c2addon package

The .c2addon file format allows plugin, behavior and effect developers to easily package their addon in to a single file. Users can then drag and drop the file in to the Construct 2 window to install it.

A .c2addon file is actually a zip file with a renamed extension. The zip file always contains info.xml in the root, and a subfolder called files. What goes in the files folder depends on whether you're publishing a plugin, behavior or effect.

info.xml

The info.xml file specifies metadata about your addon. It states whether the type is a plugin, behavior or effect, and has information like the name, version and author of the addon. Use the info.xml provided in the Javascript SDK as a starting point, and from there it should be straightforward to fill out. Be sure to write documentation and add the link to the documentation to info.xml. You can also find a template of info.xml here.

Plugin and behavior files

When distributing a plugin or behavior, the files subfolder needs to contain another subfolder. For example your folder structure in the zip would be:

info.xml
files\myplugin\common.js
files\myplugin\edittime.js
files\myplugin\PluginIcon.ico
files\myplugin\runtime.js

myplugin is the name of the plugin or behavior folder, as it should appear in the install directory. Construct 2 will simply copy and paste this entire folder, preserving the folder name.

Effect files

When distributing an effect, simply place the .fx file and .xml file for the effect in the files subfolder in the zip, for example:

info.xml
files\myeffect.fx
files\myeffect.xml

Packaging

Add all the files to a zip (right-click and 'Send to compressed (zipped) folder' in Windows Explorer). Be sure not to accidentally create a root level subfolder in the zip which itself contains info.xml - that will be rejected by Construct 2. Once zipped, rename the file so the extension is .c2addon rather than .zip. Test it by dragging and dropping the file in to the Construct 2 window. If you can install after the prompt successfully, your file is ready to distribute.

Samples

Here are some sample .c2addon packages for an example plugin, behavior and effect. To inspect the contents, rename them to .zip and open them.

myplugin.c2addon
mybehavior.c2addon
myeffect.c2addon

Tags: