1.10.09 - Pixel movement

A pixel movement makes a succession of basic translations, where each translation is a pixel-precise specified move (for example (+2,-1)). Each translation is immediate.

Unlike most other types of movements, there is no notion of speed in pixels per seconds. That's because a translation can transport the object instantly to another place - the movement is not necessarily continuous. Instead, you can set the delay between each translation.

Remarks
Pixel movements are not often needed. Most of the time, you don't want to specify pixel-by-pixel trajectories. Higher-level types of movements like path movement or target movement usually fit your needs when you move NPCs or enemies.

Methods inherited from movement

Pixel movements are particular movement objects. Therefore, they inherit all methods from the type movement.

See Methods of all movement types to know these methods.

Methods of the type pixel movement

The following methods are specific to pixel movements.

pixel_movement:get_trajectory()

Returns the trajectory of this movement.

pixel_movement:set_trajectory(trajectory)

Sets the trajectory of this movement.

Any previous trajectory is removed and the movement starts at the beginning of the new trajectory.

pixel_movement:get_loop()

Returns whether this movement restarts automatically when the trajectory is finished.

pixel_movement:set_loop([loop])

Sets whether this movement should restart automatically when the trajectory is finished.

pixel_movement:get_delay()

Returns the delay between two steps of the trajectory.

pixel_movement:set_delay(delay)

Sets the delay between two steps of the trajectory.

Events inherited from movement

Pixel movements are particular movement objects. Therefore, they inherit all events from the type movement.

See Events of all movement types to know these events.