Skip to content

Crystal Block

Overview

A crystal block is a colored low wall that may be raised or lowered in the ground.

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

Note

Crystal blocks 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.

An entity of type crystal block is a pattern of size 16×16 pixels that may be repeated horizontally and vertically like a tile.

When they are lowered in the ground, crystal blocks are traversable. When they are raised, they become obstacles. If the hero overlaps them while they get raised, then he can walk on them.

Crystal blocks exists in two colors. One of them is initially lowered and the other is initially raised. The state of crystal blocks is swapped when the hero activates a crystal or when you call map:change_crystal_state().

This state persists accross maps of the same world. It is reset when the world changes and when the savegame is reloaded.

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.