Expression

From Castle Wiki
Revision as of 07:34, 10 May 2022 by Lukalot (talk | contribs) (Add list of expression types)

Expressions in Castle are used for many things, including calculating health for characters, crafting procedural games and animations, and even making generative artwork. Expressions sometimes take in some values as arguments and always return a result value.

List of Expression Types

The following is a list of expression types in the order that they are listed when viewed in the Castle "Choose expression type" sheet

Values

  • The value of a counter
  • The value of a behavior property
  • The value of a variable
  • A constant number

Choices

  • Weighted choose
  • Choose
  • Maximum
  • Minimum

Randomness

  • A random number with a Gaussian distribution
  • Perlin noise in 2 dimensions
  • A random number in a range

Spacial relationships

  • The speed of an actor
  • The angle of motion of an actor
  • The angle from one actor to another (degrees)
  • The distance between two actors

Arithmetic

  • The number of repeats finished
  • Logarithm
  • Power
  • Modulo
  • Divide
  • Multiply
  • Subtract
  • Add

Clock

  • Time elapsed since the card started
  • The clock tempo
  • Time since the last beat
  • The current bar
  • The current beat in the current bar
  • Beats elapsed since the card started

Functions

  • The number of actors with a tag
  • Degrees to radians
  • Sine
  • Clamp a value between two bounds
  • Mix two values
  • Round
  • Round down
  • Absolute value