Difference between revisions of "Behavior"

From Castle Wiki
(Created page with "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 m...")
 
(Add behavior screenshots)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
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 [[Drag|dragging]].
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 [[Drag|dragging]].
[[File:Motion-behaviors-list.jpg|alt=A screenshot of the "add physics or controls" sheet, listing motion behaviors such as Gravity and Drag|thumb|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'''.


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 ==
== 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 to fall. After you've added a behavior to a blueprint, you can edit the behavior properties in the inspector.
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 ==
== Changing a behavior with Rules ==
Most behaviors can be changed at play time using [[Rule|Rules]]:
[[File:Modify-behavior-property-rule.jpg|alt=A screenshot of a rule which modifies velocity|thumb|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 [[Rule|Rules]]:


* The Modify a behavior property response
* 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
* 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
* The [[expression]] for '''The value of a behavior property''' can be used to read the current value of any behavior property.

Latest revision as of 18:25, 17 May 2022

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.