Events

Events are Construct 2's main feature: instead of complicated scripting or programming languages with fiddly syntax and difficult errors, you can define how the game works using a logical block system. The blocks are collectively referred to as events, although there are several kinds of block making up an event sheet.

Construct 2's event system is likely to be unfamiliar to new users. Read How Events Work for a summary of how to use them. Events are not cookie-cutter blocks that limit what you can do. Instead they are designed to provide the basic tools you need to create sophisticated games.

The basic concept of events is that conditions filter the instances meeting the condition, then the actions run for those instances only. This allows you to control instances independently, especially when used with instance variables. A common misconception is that all instances of an object type must act the same. That is simply not the case: the fundamental way events work is to filter out individual instances, and run actions on just those that met the conditions.

Events are edited in the Event Sheet View using the Add Condition/Action dialog, the Parameters dialog and Expressions panel.

A diagram of a simple event is shown below. (This does not include every feature of events - the rest are explained in this section.)

Event diagram

The parts that make up events are summarised below. Check each relevant manual section for more information on each. See How events work for a summary of how to use events.

Events typically consist of conditions that must be met, actions that run if so, and optionally further sub-events that test more conditions, run more actions, etc. For example if the condition Bullet collides with alien is met, the action Destroy alien may run, and the Destroy action affects only the instance involved in the condition.

Conditions test that certain criteria are met. They filter the instances meeting the condition.

Actions make things happen. They only affect the instances that were filtered by the event's conditions.

Expressions can be sums to work out values, or retrieve values from objects, such as a Sprite's X co-ordinate.

Sub-events follow after other events, appearing indented in the event sheet. Their conditions can further filter instances and run more actions.

Groups can be used to organise events. Groups can also be enabled and disabled as a whole.

Comments allow you to write notes and descriptions for events. They usually are placed above the event they are describing. This is essential to help keep a large project well-organised and maintainable.

Includes can share event sheets between layouts. This saves you from having to copy-and-paste all your events for every single layout. Adding an include is effectively an automatic copy-paste of that event sheet's content in to another event sheet.

Event Variables can store numbers and text either globally (for all layouts) or locally (for a specific range of events).

Event sheets are a list of events. These can be assigned to a specific layout, or included in to other event sheets.

Scripting

Construct 2 uses the event system exclusively and does not support any scripting in the editor at all. This is because the event system is powerful enough to replace scripting completely. However, if you are a programmer, you may be interested in extending Construct 2 using the Javascript SDK.

Tags: