scar
  • The scar game library
  • Application Structure
    • App
    • Scenes
    • Spaces
    • Entities
    • Components
    • Systems
    • Objects
    • Drawing
    • Events
  • Builtin Features
    • Actions
    • Assets
    • Config
    • Input
    • Logger
    • Music
    • Tweens
    • Util
    • Vectors & Rects
  • Builtin Components
    • Text
    • Sprite
    • Animated Sprite
  • Builtin Systems
    • Animate Sprites
Powered by GitBook
On this page

Was this helpful?

  1. Application Structure

Entities

PreviousSpacesNextComponents

Last updated 5 years ago

Was this helpful?

An entity itself is not that special, it is just a container for . It also has position, scale, rotation, and z attributes which can be used by e.g. rendering. Components can be inserted upon instantiation or via the << method.

The Entity class defines some convenience functions such as the has method to check wether it contains one ore more kinds of components and the [] and []? methods for component access via type. One can also get the id or get and set the array of components.

Any entity can be flagged as dead by calling Entity#suicide. The flag state can be checked via the Entity#alive? getter.

You can find an example in the section.

components
components