Skip to content

# Crystal

## Overview

A crystal is a switch that lowers or raises alternatively some special colored blocks in the ground called crystal blocks.

This type of map entity can be declared in the map data file. It can also be created dynamically with `map:create_crystal()`.

Note

Crystals provide very specific behavior for historical reasons and are not very customizable. If you need more flexibility, we recommend to use custom entities instead and to script the behavior you want.

A crystal is essentially a solid switch that inverts the configuration of crystal blocks when activated.

### Crystal sprites

Two sprites for a crystal are automatically created by the engine. You can access them like for any other entity, specifying their name in `entity:get_sprite([name])`.

- `"main"`: Main sprite representing the crystal. Its animation set is `"entities/crystal"` This is the default one in `entity:get_sprite([name])`.
- `"star"`: Star twinkling over the crystal. Its animation set is `"entities/star"`.

## Methods Inherited from map entity

Crystals are particular map entities. Therefore, they inherit all methods from the type map entity.

See entity to know these methods.

## Methods of the type `crystal`

None.

## Events inherited from map entity

Events are callback methods automatically called by the engine if you define them.

Crystals are particular map entities. Therefore, they inherit all events from the type map entity.

See entity to know these events.

## Events of the type `crystal`

None.

April 1, 2025