Solarus quests
1.6
Quest maker's reference
|
The random path movement is a particular case of path movement, where the path is chosen automatically. The resulting movement is composed of repeated random steps in the four main directions only and with a length that is a multiple of 8 pixels.
Example of use:
-- Example of code from a map script. -- Assume that there is an NPC called "bob" on this map. function sol.map:on_started() -- The map has just started: make bob walk. bob:start_movement(sol.movement.create("random_path")) end
Random path movements are particular movement objects. Therefore, they inherit all methods from the type movement.
See Methods of all movement types to know these methods.
The following methods are specific to random path movements.
Returns the speed of this movement.
Sets the speed of this movement.
speed
(number): The new speed in pixels per second.Returns the angle of the current trajectory in radians.
East is 0
, North is math.pi / 2
, West is math.pi
, South is 3 * math.pi / 2
.
Random path movements are particular movement objects. Therefore, they inherit all events from the type movement.
See Events of all movement types to know these events.