Solarus quests
1.6
Quest maker's reference
|
A target movement goes towards a target point. The target point can be a fixed point of an entity of the map. If the target is a moving map entity, the movement updates its angle to continue to go towards the entity. By default, the target is the hero when a game is running.
This type of movement can be seen as a particular case of the straight movement type, where the angle is set automatically to go towards the target.
smooth
property to true
, it will try to avoid simple obstacles by moving to a side. This is usually enough for simple enemies that target the hero. If you want a more complex technique that calculates an intelligent path to the target, see the path finding movement type.Target 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 target movements.
Sets the target of this movement as a fixed point or a map entity.
To target a fixed point:
x
(number): X coordinate of the target.y
(number): Y coordinate of the target.To target a map entity (only during a game):
entity
(entity): The entity to target.x
(number, optional): X offset to add to the target entity's coordinates. Default is 0
.y
(number, optional): Y offset to add to the target entity's coordinates. Default is 0
.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 trajectory in radians.
East is 0
, North is math.pi / 2
, West is math.pi
, South is 3 * math.pi / 2
and any intermediate value is possible.
Returns whether this movement adjusts its trajectory when an obstacle of the map is reached. This property has no effect if the movement is not attached to a map entity or if the movement ignores obstacles.
true
if this movement is smooth.Sets whether this movement should adjust its trajectory when an obstacle of the map is reached. This property has no effect if the movement is not attached to a map entity or if the movement ignores obstacles.
smooth
(boolean, optional): true
to make this movement smooth. No value means true
.Target movements are particular movement objects. Therefore, they inherit all events from the type movement.
See Events of all movement types to know these events.