Solarus quests  1.5
Quest maker's reference
Circle movement

A circle movement makes a circular trajectory around a center point or a map entity.

Methods inherited from movement

Circle 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 circle movement

The following methods are specific to circle movements.

circle_movement:set_center(x, y), circle_movement:set_center(entity, [dx, dy])

Sets the center of this movement as a fixed point or a map entity.

To make circles around a fixed point:

  • x (number): X coordinate of the center.
  • y (number): Y coordinate of the center.

To make circles around a map entity (only during a game):

  • entity (entity): The center entity.
  • dx (number, optional): X offset to add to the center entity's coordinates (default 0).
  • dy (number, optional): Y offset to add to the center entity's coordinates (default 0).

circle_movement:get_radius()

Returns the radius of circles to make.

If circle_movement:get_radius_speed() is not 0, radius changes are made gradually.

  • Return value (number): The wanted radius in pixels.

circle_movement:set_radius(radius)

Sets the radius of circles to make.

If circle_movement:get_radius_speed() is not 0, the radius will be updated gradually.

  • radius (number): The new wanted radius in pixels.

circle_movement:get_radius_speed()

Returns the speed of radius changes.

  • Return value (number): The speed in pixels per second, or 0 if radius changes are immediate.

circle_movement:set_radius_speed(radius_speed)

Sets the radius to be updated immediately of gradually (at the specified speed) towards its wanted value.

  • radius_speed (number): The speed of radius changes in pixels per second, or 0 to make radius changes immediate.

circle_movement:is_clockwise()

Returns whether circles are made clockwise or counter-clockwise.

  • Return value (boolean): true if circles are clockwise.

circle_movement:set_clockwise([clockwise])

Sets whether circles are made clockwise or counter-clockwise.

  • clockwise (boolean, optional): true to make circles clockwise. No value means true.

circle_movement:get_initial_angle()

Returns the angle from where the first circle starts.

  • Return value (number): The initial angle in degrees.

circle_movement:set_initial_angle(initial_angle)

Sets the angle from where the first circle should start.

  • initial_angle (number): The initial angle in degrees.

circle_movement:get_angle_speed()

Returns the speed of the angle variation.

  • Return value (number): The angle speed in degrees per second.

circle_movement:set_angle_speed(angle_speed)

Sets the speed of the angle variation.

  • angle_speed (number): The new angle speed in degrees per second.

circle_movement:get_max_rotations()

Returns the maximum number of rotations of this movement.

When this number of rotations is reached, the movement stops.

  • Return value (number): The maximum number of rotations to make (0 means infinite).

circle_movement:set_max_rotations(max_rotations)

Sets the maximum number of rotations of this movement.

When this number of rotations is reached, the movement stops.

  • max_rotations (number): The maximum number of rotations to make (0 means infinite).
Remarks
The movement stops itself by setting its radius to 0. Therefore, if the radius is set to change gradually (see circle_movement:get_radius_speed()), the movement will continue for a while until the radius reaches 0.
When the movement has stopped, it restarts later if it was set to loop (see circle_movement:get_loop_delay()), and again, possibly gradually.

circle_movement:get_duration()

Returns the maximum duration of this movement.

When this delay is reached, the movement stops.

  • Return value (number): The duration of the movement in milliseconds (0 means infinite).

circle_movement:set_duration(duration)

Sets the maximum duration of this movement.

When this delay is reached, the movement stops.

  • duration (number): The duration of the movement in milliseconds (0 means infinite).
Remarks
The movement is stopped by automatically setting its radius to 0. Therefore, if the radius is set to change gradually (see circle_movement:get_radius_speed()), the movement will continue for a while until the radius reaches 0.
When the movement has stopped, it will then restart if it was set to loop (see circle_movement:set_loop_delay()), and again, possibly gradually.

circle_movement:get_loop_delay()

Returns the delay after which this movement restarts.

  • Return value (number): The restart delay in milliseconds (0 means no restart).

circle_movement:set_loop_delay(loop_delay)

Sets the delay after which this movement restarts.

  • loop_delay (number): The restart delay in milliseconds (0 means no restart).
Remarks
This delay is applied if the movement get stopped by reaching the maximum number of rotations or the maximum duration.
When the movement restarts, the radius starts from 0 and gets back to its previous value, possibly gradually (see circle_movement:set_radius_speed()).

Events inherited from movement

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

See Events of all movement types to know these events.