Condition

From Castle Wiki

A Condition is a type of Response which only runs its enclosed logic when a certain condition is true.

For example, imagine an adventure game where the player needs to use a pick to mine gold. When the player touches a piece of gold, you need to check if they have the pick to decide what to do. You might write a rule like this:

When this collides with tag #gold:
  If variable $has_axe equals 1:
    Tell the colliding actor: Destroy this actor
    Set variable $num_gold to 1 (Relative)
  Else:
    Create text box "You need the axe to get the gold"

For more information on how to add conditions and responses, see Rules.

List of conditions

State

Collision

  • If this is colliding

Random

  • If a coin flip shows heads

Camera

  • If this is in the camera viewport

Draw

  • If the animation frame meets a condition