ESCMovable
Extends: Node
Description
Node that performs the moving (walk, teleport, terrain scaling…) actions on its parent node.
Enumerations
MovableTask
const MovableTask: Dictionary = {"NONE":0,"SLIDE":2,"WALK":1}
Tasks carried out by this walkable node NONE - The node is inactive WALK - The node walks the parent somewhere SLIDE - The node slides the parent somewhere
Property Descriptions
walk_path
var walk_path: Array
Character path through the scene as calculated by the Pathfinder
path_ofs
var path_ofs: int
Current active walk path entry
walk_destination
var walk_destination: Vector2
The destination where the character should be moving to
walk_context
var walk_context: ESCWalkContext
The walk context currently carried out by this movable node
moved
var moved: bool
Whether the character was moved at all
last_dir
var last_dir: int
Player Direction used to reflect the movement to the new position
last_scale
var last_scale: Vector2
The last scaling applied to the parent
is_mirrored
var is_mirrored: bool
Whether the current direction animation is flipped
parent
var parent
Shortcut variable that references the node’s parent
task
var task
Currenly running task
Method Descriptions
teleport
func teleport(target: Node) -> void
Teleports this item to the target position.
Parameters
target: Position2d or ESCItem to teleport to
teleport_to
func teleport_to(target: Vector2) -> void
Teleports this item to the target position.
Parameters
target: Vector2 target position to teleport to
walk_to
func walk_to(pos: Vector2, p_walk_context: ESCWalkContext = null) -> void
Walk to a given position
Parameters
pos: Position to walk to
p_walk_context: Walk context to use
walk_stop
func walk_stop(pos: Vector2) -> void
We have finished walking. Set the idle pose and complete
Parameters
pos: Final target position
update_terrain
func update_terrain(on_event_finished_name = null) -> void
Update the sprite scale and lighting
Parameters
on_event_finished_name: Used if this function is called from an ESC event
set_angle
func set_angle(deg: int, wait: float = 0) -> var
Sets character’s angle and plays according animation.
Parameters
deg int angle to set the character
wait float Wait this amount of seconds until continuing with turning around
turn_to
func turn_to(item: Node, wait: float = 0) -> void
Turns the character to face another item or character.
Parameters
item_id id of the object to face.
float Wait this amount of seconds until continuing with turning around
get_shortest_way_to_dir
func get_shortest_way_to_dir(current_dir: int, target_dir: int) -> int
Return the shortest way to turn from a direction to another. Returned way is either: -1 (shortest way is to turn anti-clockwise) 0 (already at the right direction) 1 (clockwise).
####Parameters
current_dir: integer corresponding to the starting direction as defined in the attached ESCAnimationResource.directions.
target_dir: integer corresponding to the target direction as defined in the attached ESCAnimationResource.directions.
Returns Integer: -1 (anti-clockwise), 1 (clockwise) or 0 (no movement needed).