SpatialComponent - acrimi/Raven GitHub Wiki

SpatialComponent defines the position and size of an entity in 2d space, as well as its orientation and the index of the entity layer in which it currently resides. Most entities will usually have at least a SpatialComponent, but it can be omitted to create entities that function as more global processes.

Configuration

When used inside the components block, the initial state of the component can be configured with the following parameters:

Key Type Description
x float The entity's initial left position
y float The entity's initial bottom position
width float The width of the entity's bounding box
height float The height of the entity's bounding box
orientation string The entity's initial orientation, case insensitive (eg "up", "UP", "Left"). See EntityOrientation for all values.
layerIndex int The index of the entity layer this entity is initially in. This is usually set automatically by the map file or spawn point.

Example:

"SpatialComponent": {
  "x": 100.5,
  "y": 50,
  "width": 16,
  "height": 16,
  "orientation": "left",
  "layerIndex": 0
}

Properties

The following properties are readable by property accessors (eg render state and persistence definitions):

Key Type Description
x float The current value of the entity's left position
y float The current value of the entity's bottom position
orientation string The entity's current orientation (eg "UP", "DOWN", etc). See EntityOrientation for all values.