Your plugin properties specify what appears in the properties bar when your plugin is selected. Construct 2 adds its own properties for most plugins. However, you can specify custom properties which are shown at the bottom of the properties bar. For behaviors, properties appear in a sub-category of the behaviors category.
Properties are specified in edittime.js. By convention, they follow the ACE definitions.
var property_list = [
// a list of cr.Property objects
Each property should be a new cr.Property object:
new cr.Property(type, name, initial_value, description[, param, readonly])
One of the following property types:
An integer number. Floating point numbers cannot be entered to integer properties.
A floating point number.
A text property.
A color selector. The runtime receives an rgb string, e.g. "rgb(255,255,255)".
A font selector. The runtime receives a string formatted "facename,size,weight,italic".
A combo box property. Items are specified in the param parameter of cr.Property as a pipe-separated string, e.g. "One|Two|Three".
A link property. Links do not have any associated value nor are they passed to the runtime; they simply allow you to do something in OnPropertyChanged() when it is clicked.
Creates a new header in the properties bar. Useful for splitting up long property lists in to groups, like with the Particles object.
The name of the property.
The text that appears as a tip at the bottom of the properties bar. Try to keep it brief, but as helpful as possible to the user. Any opportunity to save the user a trip to the manual is worth taking.
For combo properties, a pipe-separated string specifying the combo box items, e.g. "One|Two|Three". For link parameters, this can be one of the following values:
By default, clicking a link calls OnPropertyChanged() once for each of the selected instances. If you are performing an action on the object type, such as invoking the image editor, specifying "firstonly" calls OnPropertyChanged() once only for the first selected instance rather than repeatedly.
Create a 'world' undo point before calling OnPropertyChanged(). This allows undoing any change in position, size or angle. Sprite uses this so 'Make 1:1' can be undone.
Set to true to make the property read-only (uneditable).
Getting property values at runtime
In your instance's onCreate() function in runtime.js, properties are available via the array this.properties. This is an array of the property values. The values are in the same order as the properties were added, excluding link properties. For example, if you have two link properties followed by three integer properties, this.properties only has three elements (the three integer properties in the order they were added).