Behavior

From Castle Wiki

A Behavior is a component of a Blueprint which specifies how the blueprint's actors should behave. Common examples of behaviors include different types of physical movement, such as responding to Gravity, and interactive controls, such as dragging.

A screenshot of the "add physics or controls" sheet, listing motion behaviors such as Gravity and Drag
The "Add physics or controls" sheet, listing some available behaviors

The most common way to add behaviors to blueprints is to open the Inspector, navigate to the Movement tab, and press Add physics or controls.

Another example of a behavior is Music, which can be added from the General tab of the Inspector.

Behavior properties

Many behaviors have adjustable properties. For example, the Gravity behavior has a property strength which governs how strong the force of gravity should be when it causes that blueprint's actors to fall. After you've added a behavior to a blueprint, you can edit the behavior properties in the inspector.

Changing a behavior with Rules

A screenshot of a rule which modifies velocity
The "Modify a behavior property" response can be used to change an actor's velocity, among other things

You can edit any behavior from the Inspector while you are creating a deck. However, it's often useful to change how certain actors behave in the middle of playing the deck. Most behaviors can be changed at play time using Rules:

  • The Modify a behavior property Response. For example, you could make gravity weaker when the player picks up an item.
  • The responses for enabling and disabling a behavior. For example, you could disable slinging a golf ball while the ball is already in the air, then re-enable it when the ball stops moving.
  • The expression for The value of a behavior property can be used to read the current value of any behavior property.