1.14.21 - Stream

When walking on a stream, the hero automatically moves into one of the eight main directions.

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

Overview

A stream is a map entity of size 16x16 pixels (the size of the hero). When the hero overlaps a significant part of it, he moves into a specific direction (one of the 8 main directions).

During this process, the player may or may not continue to control the hero, use his sword and his equipment items, depending on the stream properties.

The hero is not the only map entity that can follow a stream: Bombs also have this ability.

Streams and holes

If you make a stream that moves toward a hole or other bad ground, it is your responsibility to make sure to call hero:save_solid_ground() before (typically, when entering the room), otherwise the hero will reappear on the stream, one pixel before the hole and he will fall again repeatedly.

Methods inherited from map entity

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

See Methods of all entity types to know these methods.

Methods of the type stream

The following methods are specific to streams.

stream:get_direction()

Returns the direction of this stream.

This direction will be applied to entities that follow the stream.

stream:set_direction(direction)

Sets the direction of this stream.

This direction will be applied to entities that follow the stream.

stream:get_speed()

Returns the speed applied by this stream.

stream:set_speed(speed)

Sets the speed applied by this stream.

stream:get_allow_movement()

Returns whether the player can still move the hero while being on this stream.

stream:set_allow_movement(allow_movement)

Sets whether the player can still move the hero while being on this stream.

stream:get_allow_attack()

Returns whether the player can still use the sword while being on this stream.

stream:set_allow_attack(allow_attack)

Sets whether the player can still use the sword while being on this stream.

stream:get_allow_item()

Returns whether the player can still use equipment items while being on this stream.

stream:set_allow_item(allow_item)

Sets whether the player can still use equipment items while being on this stream.

Events inherited from map entity

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

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

See Events of all entity types to know these events.

Events of the type stream

None.