How to make a .c2addon file

For developers using the Construct 2 Javascript SDK

Post » Thu Feb 21, 2013 8:50 pm

The SDK documentation won't let me post this article right now, so I'm posting it here. Will get Tom to fix the site shortly :) This covers how to make the new .c2addon files supported in r120+.

-------------

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. It should be straightforward to fill out. Be sure to write documentation and add the link to the documentation to info.xml.

#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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Fri Feb 22, 2013 12:13 am

@Ashley

Would you please provide a sample ".c2addon" file?rexrainbow2013-02-22 00:13:45
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Sat Feb 23, 2013 12:30 pm

Yes, please! I'm just about to release another effect.

@Ashley
Are we able to provide more than one plugin/behavior/effect with one .c2addon?
B
59
S
7
G
2
Posts: 93
Reputation: 4,228

Post » Mon Feb 25, 2013 6:00 pm

@Ashley
+1 rexrainbow asked you.
B
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » Mon Feb 25, 2013 7:22 pm

Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Tue Feb 26, 2013 12:21 am

@Ashley

Thanks, one more question: Will C2 IDE check the version describe at xml?
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Tue Feb 26, 2013 12:26 am

No, the version in info.xml is simply displayed on the prompt. It will overwrite the files even if it's older than the previous version.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Tue Feb 26, 2013 3:19 am

@Ashley

Thanks, because I forgot updated the version number usually.
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Tue Feb 26, 2013 5:49 am

@Ashley - nice, it works!

i can imagine some improvements:

- associate the file extension with c2!
- make the infos availabe in the corresponding dialogs, not just at install-time. it would greatly serve the purpose of telling what the addons actually do, if the user isn't quite sure.
- why is it being extracted? keeping it as a c2addon would keep the directories "clean"
- future option to have password protected c2addons to be able to offer paid addons. just came to my mind.. i should elaborate on that later...
B
59
S
7
G
2
Posts: 93
Reputation: 4,228

Post » Fri Mar 01, 2013 6:30 pm

@Ashley

After testing this out i encountered 2 little issues in the dialog prompt:

1) The urls (website/documentation) are cut off after a certain length

2) The urls do link to the pages.
B
59
S
7
G
2
Posts: 93
Reputation: 4,228

Next

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests