struct State

Overview

Represents the current state of a game. You can inject more fields into this to extend functionality.

Example:

Add a timestamp to the state. Properties prefixed with a YAML::Field annotation will automatically persist between saves.

struct State
  @[YAML::Field(key: "timestamp")]
  property timestamp : Time?
end

By itself, state properties don't do anything. You can read and change state in a Scene or Command.

Included Modules

Defined in:

engine/state.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new #

[View source]

Instance Method Detail

def character : Character #

[View source]
def character=(character : Character) #

[View source]
def scene : String? #

[View source]
def scene=(scene : String?) #

[View source]