PopochiuCharacter

Inherits: PopochiuClickable

Description

Represents a character in the game that can move, talk, and interact with objects.

Characters can navigate rooms using walkable areas, speak dialog lines, play animations, carry inventory items, and follow or face other characters. One character is typically designated as the player-controlled character (PC).


Properties

Type Name Default
float alpha 1.0
Variant anim_suffix EMPTY_STRING
String animation_prefix ""
bool anti_glide_animation false
Variant avatars []
Variant can_move true
String current_animation get_current_animation
Variant default_scale Vector2.ONE
Variant default_walk_speed 0
Vector2 dialog_pos
Vector2 dialog_pos_offset Vector2.ZERO
Vector2 dialog_pos_override Vector2.INF
Variant emotion EMPTY_STRING
Variant face_character ""
FlipsWhen flips_when FlipsWhen.NONE
Variant follow_character ""
Variant follow_character_offset Vector2(20, -5)
Variant follow_character_outside_room false
Variant follow_character_threshold Vector2(35, 10)
String idle_animation STANDARD_IDLE_ANIMATION
Variant ignore_obstacles false
Variant ignore_walkable_areas false
bool is_animating get_is_animating
bool is_talking get_is_talking
bool is_visible_in_room get_is_visible_in_room
Variant last_room EMPTY_STRING
bool obstacle false
Dictionary scaling_region {}
String talk_animation STANDARD_TALK_ANIMATION
Vector2 target_position get_target_position
Variant text_color Color.WHITE
Variant voices []
String walk_animation STANDARD_WALK_ANIMATION
Variant walk_speed 200.0

Methods

Return Type Method
void _on_movement_ended() virtual
void _on_movement_started() virtual
void _on_position_changed() virtual
void _play_grab() virtual
void _play_idle() virtual
void _play_talk() virtual
void _play_walk(target_pos: Vector2) virtual
void face_away()
void face_clicked()
void face_direction(destination: Vector2)
void face_down()
void face_down_left()
void face_down_right()
void face_left()
void face_right()
void face_up()
void face_up_left()
void face_up_right()
void fade_in(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT)
void fade_out(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT)
void fade_to(target_alpha: float, duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT)
Vector2 get_actual_dialog_pos()
Texture get_avatar_for_emotion(emo = EMPTY_STRING)
Vector2 get_buffered_position()
String get_current_animation()
float get_dialog_pos()
bool get_is_animating()
bool get_is_talking()
bool get_is_visible_in_room()
NavigationObstacle2D get_navigation_obstacle()
Vector2 get_target_position()
void grab()
void halt_animation()
void idle()
bool is_facing(dir: Looking)
bool is_facing_any(dirs: Array[Looking])
void lock_dialog_pos()
void pause_animation()
void play_animation(animation_label: String, animation_fallback = "")
Callable queue_face_away()
Callable queue_face_clicked()
Callable queue_face_down()
Callable queue_face_down_left()
Callable queue_face_down_right()
Callable queue_face_left()
Callable queue_face_right()
Callable queue_face_up()
Callable queue_face_up_left()
Callable queue_face_up_right()
Callable queue_fade_in(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT)
Callable queue_fade_out(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT)
Callable queue_fade_to(target_alpha: float, duration: float, set_enablement: bool = false)
Callable queue_grab()
void queue_halt_animation()
Callable queue_idle()
Callable queue_ignore_walkable_areas(new_value: bool)
Callable queue_lock_dialog_pos()
void queue_pause_animation()
Callable queue_play_animation(animation_label: String, animation_fallback = "", blocking = false)
Callable queue_reset_dialog_pos_offset()
Callable queue_reset_dialog_pos_override()
void queue_resume_animation()
Callable queue_say(dialog: String, emo = EMPTY_STRING)
Callable queue_set_animation_prefix(new_prefix: String)
Callable queue_set_emotion(new_emotion: String)
Callable queue_set_idle_animation(new_name: String)
Callable queue_set_talk_animation(new_name: String)
Callable queue_set_walk_animation(new_name: String)
void queue_stop_animation()
Callable queue_stop_walking()
Callable queue_unlock_dialog_pos()
Callable queue_walk(target_pos: Vector2)
Callable queue_walk_to(pos: Vector2)
Callable queue_walk_to_clicked(offset = Vector2.ZERO)
Callable queue_walk_to_clicked_blocking(offset = Vector2.ZERO)
Callable queue_walk_to_hotspot(id: String, offset = Vector2.ZERO)
Callable queue_walk_to_marker(id: String, offset = Vector2.ZERO)
Callable queue_walk_to_prop(id: String, offset = Vector2.ZERO)
void reset_animation_prefix()
void reset_buffered_position()
void reset_dialog_pos_offset()
void reset_dialog_pos_override()
void resume_animation()
void say(dialog: String, emo = EMPTY_STRING)
void set_alpha(value: float)
void set_animation_prefix(value: String)
void set_avatars(value: Array)
void set_idle_animation(value: String)
void set_obstacle(value: bool)
void set_talk_animation(value: String)
void set_voices(value: Array)
void set_walk_animation(value: String)
void start_facing_character(character: Variant = null)
void start_following_character(character: Variant = null)
void stop_animation()
void stop_facing_character()
void stop_following_character()
void stop_walking()
void sync_buffered_position()
void turn_towards(target_pos: Vector2)
void unlock_dialog_pos()
void update_position()
void update_scale()
void walk(target_pos: Vector2)
void walk_to(pos: Vector2)
void walk_to_clicked(offset = Vector2.ZERO)
void walk_to_clicked_blocking(offset = Vector2.ZERO)
void walk_to_hotspot(id: String, offset = Vector2.ZERO)
void walk_to_marker(id: String, offset = Vector2.ZERO)
void walk_to_prop(id: String, offset = Vector2.ZERO)

Signals


Enumerations


Constants

Name Value
EMPTY_STRING ""
STANDARD_IDLE_ANIMATION "idle"
STANDARD_TALK_ANIMATION "talk"
STANDARD_WALK_ANIMATION "walk"

Signal Descriptions

grab_done

signal grab_done()

Emitted when the animation to grab things has finished.


obstacle_state_changed

signal obstacle_state_changed(character: PopochiuCharacter)

Emitted when the obstacle flag state is changed.


position_updated

signal position_updated(character: PopochiuCharacter, current_position: Vector2)

Emitted during movement when the character's position changes. Only emitted while the character is moving and the position has actually changed from the last emission.


started_walk_to

signal started_walk_to(character: PopochiuCharacter, start: Vector2, end: Vector2)

Emitted when a character starts moving from start to end. The character connects to this signal internally to handle its own movement.


stopped_walk

signal stopped_walk()

Emitted when the character is forced to stop while walking.


Enumeration Descriptions

enum FlipsWhen

Determines when to flip the $Sprite2D child.

enum FlipsWhen {
    NONE,
    LOOKING_RIGHT,
    LOOKING_LEFT,
}

enum Looking

Determines the direction the character is facing

enum Looking {
    RIGHT,
    DOWN_RIGHT,
    DOWN,
    DOWN_LEFT,
    LEFT,
    UP_LEFT,
    UP,
    UP_RIGHT,
}

Constant Descriptions

EMPTY_STRING

const EMPTY_STRING = ""

Empty string constant to perform type checks (String is not nullable in GDScript. See #381, #382).


STANDARD_IDLE_ANIMATION

const STANDARD_IDLE_ANIMATION = "idle"

Standard idle animation name.


STANDARD_TALK_ANIMATION

const STANDARD_TALK_ANIMATION = "talk"

Standard talk animation name.


STANDARD_WALK_ANIMATION

const STANDARD_WALK_ANIMATION = "walk"

Standard walk animation name.


Property Descriptions

alpha

@export_range(0.0, 1.0) var alpha : float = 1.0
  • Setter: set_alpha

Opacity of the character. Range: 0.0 (fully transparent) to 1.0 (fully opaque). Setting this value will modulate the alpha channel of the $Sprite2D child.


anim_suffix

var anim_suffix = EMPTY_STRING

The suffix text to add to animation names.


animation_prefix

@export var animation_prefix : String = ""
  • Setter: set_animation_prefix

Animation prefix for outfit changes (e.g., "pajama", "armor"). When set, the engine will search for prefixed animations like "pajama_walk_r" before falling back to basic "walk_r" animations.


anti_glide_animation

@export var anti_glide_animation : bool = false

Whether the character will move only when the frame changes on its animation.


avatars

@export var avatars = []
  • Setter: set_avatars

Array of Dictionary where each element has { emotion: String, avatar: Texture }. You can use this to define which Texture to use as avatar for the character when it speaks using a specific emotion.


can_move

@export var can_move = true

Whether the character can or not move.


current_animation

var current_animation : String = get_current_animation
  • Getter: get_current_animation

Returns the current animation being played. Read-only access to _current_animation. This property cannot be set from outside the character implementation.


default_scale

var default_scale = Vector2.ONE

Stores the default scale. Used by PopochiuRoom when scaling the character if it is inside a PopochiuRegion that modifies the scale.


default_walk_speed

var default_walk_speed = 0

Stores the default walk speed defined in walk_speed. Used by PopochiuRoom when scaling the character if it is inside a PopochiuRegion that modifies the scale.


dialog_pos

@export var dialog_pos : Vector2

Used by the GUI to calculate where to render the dialogue lines said by the character when it speaks.


dialog_pos_offset

var dialog_pos_offset : Vector2 = Vector2.ZERO

Offset from the character's dialog_pos. Added to the normal dialog position.


dialog_pos_override

var dialog_pos_override : Vector2 = Vector2.INF

Absolute world coordinates for dialog position. Overrides dialog_pos entirely when not set. By convention Vector2.INF means "unset" (instead of using Vector2.ZERO which is a valid position).


emotion

var emotion = EMPTY_STRING

The current emotion used by the character.


face_character

@export var face_character = ""

The script_name of the character that this character should continuously face. Set this in the inspector to have the character automatically face another character at runtime.


flips_when

@export var flips_when : FlipsWhen = FlipsWhen.NONE

Depending on its value, the $Sprite2D child will be flipped horizontally depending on which way the character is facing. If the value is NONE, then the $Sprite2D child won't be flipped.


follow_character

@export var follow_character = ""

The script_name of the character that this character should follow when it moves through the room. Set this in the inspector to have the character automatically follow another character at runtime.


follow_character_offset

@export var follow_character_offset = Vector2(20, -5)

The positional offset from the followed character where this character will walk to when following. follow_character_offset.x defines the lateral (side-to-side) distance. The follower will stay to the left or right of the leader based on their relative positions. follow_character_offset.y defines the vertical offset. Positive values place the follower lower/in front, negative values place them higher/behind. Example: Vector2(20, -5) = "Stay 20px to the side, 5px higher (slightly behind in perspective)"


follow_character_outside_room

@export var follow_character_outside_room = false

When true, this character will be automatically transferred to the target room when the followed character changes rooms. The follower will appear at the followed character's position plus follow_character_offset. Chain-following is supported: if A follows B and B follows C, and C changes room, both A and B will transfer.


follow_character_threshold

@export var follow_character_threshold = Vector2(35, 10)

The minimum distance the followed character must be from this character before following starts. This creates a "rubber band" effect where the follower doesn't move on every step of the leader. follow_character_threshold.x defines the horizontal trigger distance. follow_character_threshold.y defines the vertical trigger distance. The follower will start moving when the leader exceeds the threshold on either axis. Example: Vector2(35, 10) = "Start following if leader is >35px away horizontally OR >10px away vertically" Set to Vector2.ZERO to make the follower move on every step (no threshold).


idle_animation

@export var idle_animation : String = STANDARD_IDLE_ANIMATION
  • Setter: set_idle_animation

The root name for idle animations. Directional suffixes will be added automatically.


ignore_obstacles

@export var ignore_obstacles = false

Whether the character ignores or not obstacles in walkable areas. If true, the character will move within a walkable area, ignoring obstacle polygons that might block the path.


ignore_walkable_areas

@export var ignore_walkable_areas = false

Whether the character ignores or not walkable areas. If true, the character will move to any point in the room clicked by players without taking into account the walkable areas in it.


is_animating

var is_animating : bool = get_is_animating
  • Getter: get_is_animating

Whether the character is currently playing an animation (other than walk, talk, or idle). Returns true if the character is playing any animation that is not a walk, talk, or idle animation variant.


is_talking

var is_talking : bool = get_is_talking
  • Getter: get_is_talking

Whether the character is currently talking (during say() execution). Returns true from the moment say() is called until the dialog line finishes.


is_visible_in_room

var is_visible_in_room : bool = get_is_visible_in_room
  • Getter: get_is_visible_in_room

Whether the character is visible in the current room. Returns true only if the character is visible and belongs to the current active room.


last_room

var last_room = EMPTY_STRING

Stores the script_name of the previously visited PopochiuRoom.


obstacle

@export var obstacle : bool = false
  • Setter: set_obstacle

When true, this character will be considered an obstacle and its obstacle polygon (if available) will be carved from all PopochiuWalkableAreas it intersects in the room. Set this to false to ignore its encumbrance during pathfinding.


scaling_region

var scaling_region : Dictionary = {}

talk_animation

@export var talk_animation : String = STANDARD_TALK_ANIMATION
  • Setter: set_talk_animation

The root name for talk animations. Directional suffixes will be added automatically.


target_position

var target_position : Vector2 = get_target_position
  • Getter: get_target_position

The position the character is walking towards. Returns Vector2.ZERO if not moving. This represents the final destination of the current navigation path.


text_color

@export var text_color = Color.WHITE

The Color in which the dialogue lines of the character are rendered.


voices

@export var voices = []
  • Setter: set_voices

Array of Dictionary where each element has { emotion: String, variations: Array[PopochiuAudioCue](PopochiuAudioCue.md) }. You can use this to define which PopochiuAudioCues to play when the character speaks using a specific emotion.


walk_animation

@export var walk_animation : String = STANDARD_WALK_ANIMATION
  • Setter: set_walk_animation

The root name for walk animations. Directional suffixes will be added automatically.


walk_speed

@export var walk_speed = 200.0

The speed at which the character will move in pixels per frame.


Method Descriptions

_on_movement_ended

func _on_movement_ended() -> void

This is a virtual method. Override it in your subclass.

Called when the character stops moving. Override to add custom behavior such as triggering events or updating game state.


_on_movement_started

func _on_movement_started() -> void

This is a virtual method. Override it in your subclass.

Called when the character starts moving. Override to add custom behavior such as playing sound effects or updating UI elements.


_on_position_changed

func _on_position_changed() -> void

This is a virtual method. Override it in your subclass.

Called after the character's position changes to synchronize the buffered position state.

Override to implement custom behavior when the position changes. Call super() if you want to preserve the base functionality.


_play_grab

func _play_grab() -> void

This is a virtual method. Override it in your subclass.

Plays the character's grab animation.

Override to implement custom grab behavior. Call super() if you want to preserve the base functionality.


_play_idle

func _play_idle() -> void

This is a virtual method. Override it in your subclass.

Plays the character's idle animation.

Override to implement custom idle behavior. Call super() if you want to preserve the base functionality.


_play_talk

func _play_talk() -> void

This is a virtual method. Override it in your subclass.

Plays the character's talk animation.

Override to implement custom talk behavior. Call super() if you want to preserve the base functionality.


_play_walk

func _play_walk(target_pos: Vector2) -> void

This is a virtual method. Override it in your subclass.

Plays the character's walk animation toward target_pos.

Override to implement custom walk behavior. Call super() if you want to preserve the base functionality.


face_away

func face_away() -> void

Makes the character face the opposite direction. Useful for turning around without knowing the current direction. Calling twice returns to the original direction.


face_clicked

func face_clicked() -> void

Makes the character face the last clicked PopochiuClickable stored in clicked.


face_direction

func face_direction(destination: Vector2)

Makes the character look in the direction of destination. The result is one of the values defined by Looking.


face_down

func face_down() -> void

Makes the character face down and plays idle animation.


face_down_left

func face_down_left() -> void

Makes the character face down-left and plays idle animation.


face_down_right

func face_down_right() -> void

Makes the character face down-right and plays idle animation.


face_left

func face_left() -> void

Makes the character face left and plays idle animation.


face_right

func face_right() -> void

Makes the character face right and plays idle animation.


face_up

func face_up() -> void

Makes the character face up and plays idle animation.


face_up_left

func face_up_left() -> void

Makes the character face up-left and plays idle animation.


face_up_right

func face_up_right() -> void

Makes the character face up-right and plays idle animation.


fade_in

func fade_in(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT) -> void

Gradually increases alpha to 1.0 over duration seconds. If set_enablement is true, enables the character when complete.


fade_out

func fade_out(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT) -> void

Gradually decreases alpha to 0.0 over duration seconds. If set_enablement is true, disables the character when complete.


fade_to

func fade_to(target_alpha: float, duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT) -> void

Gradually transitions alpha to target_alpha (clamped between 0.0 and 1.0) over duration seconds. If set_enablement is true, enables/disables based on final alpha (0.0 means disabled, anything else means enabled).

trans and ease define the transition and easing types (see [Tween.TransitionType] and [Tween.EaseType]).


get_actual_dialog_pos

func get_actual_dialog_pos() -> Vector2

Returns the actual dialog position considering offset, override, and locked state. Always returns position relative to the character.


get_avatar_for_emotion

func get_avatar_for_emotion(emo = EMPTY_STRING) -> Texture

Returns the Texture of the avatar defined for the emo emotion. Returns null if no avatar is found. If there is an avatar defined for the "" emotion, that one is returned by default.


get_buffered_position

func get_buffered_position() -> Vector2

Returns either the _buffered_position of the character, or its current transformer position, if that's not available


get_current_animation

func get_current_animation() -> String

get_dialog_pos

func get_dialog_pos() -> float

Returns the y value of the dialog_pos Vector2 that defines the position of the dialog lines said by the character when it talks.


get_is_animating

func get_is_animating() -> bool

Getter function. Returns whether the character is playing a custom animation (excludes walk, talk, and idle variants)


get_is_talking

func get_is_talking() -> bool

Getter function. Returns whether the character is currently in the middle of saying a dialog line


get_is_visible_in_room

func get_is_visible_in_room() -> bool

Getter function. Returns whether the character is both visible and belongs to the currently active room


get_navigation_obstacle

func get_navigation_obstacle() -> NavigationObstacle2D

Returns the NavigationObstacle2D if it has a defined polygon and the character is set as obstacle, [null] otherwise.

This method checks if the obstacle has at least 3 vertices to form a valid polygon.


get_target_position

func get_target_position() -> Vector2

Getter function. Returns the final destination position from the navigation path, or Vector2.INF if not moving


grab

func grab() -> void

Plays the grab animation and waits for grab_done, then returns to idle.


halt_animation

func halt_animation()

Immediately stops the current animation and switches to idle.


idle

func idle() -> void

Puts the character in idle state, playing its idle animation and flipping the sprite based on flips_when.


is_facing

func is_facing(dir: Looking) -> bool

Checks if the character is currently facing a specific direction.

Returns true if the character's current facing direction (_looking_dir) matches the provided direction.

Example:

# Check if character is looking left
if character.is_facing(PopochiuCharacter.Looking.LEFT):
    print("Looking left!")

is_facing_any

func is_facing_any(dirs: Array[Looking]) -> bool

Checks if the character is currently facing any of the specified directions.

Returns true if the character's current facing direction (_looking_dir) matches any of the directions in the provided array.

Example:

# Check if character is looking in any left direction
if character.is_facing_any([
    PopochiuCharacter.Looking.LEFT,
    PopochiuCharacter.Looking.UP_LEFT,
    PopochiuCharacter.Looking.DOWN_LEFT
]):
    print("Looking lefty!")

lock_dialog_pos

func lock_dialog_pos() -> void

Locks the dialog position at the current calculated global position.


pause_animation

func pause_animation()

Pauses the current animation.


play_animation

func play_animation(animation_label: String, animation_fallback = "")

Plays the animation_label animation, falling back to animation_fallback if not found.


queue_face_away

func queue_face_away() -> Callable

Makes the character face the opposite direction. Useful for turning around without knowing the current direction. Calling twice returns to the original direction.

This method is intended to be used inside a queue() of instructions.


queue_face_clicked

func queue_face_clicked() -> Callable

Makes the character face the last clicked PopochiuClickable stored in clicked.

This method is intended to be used inside a queue() of instructions.


queue_face_down

func queue_face_down() -> Callable

Makes the character face down and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_down_left

func queue_face_down_left() -> Callable

Makes the character face down-left and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_down_right

func queue_face_down_right() -> Callable

Makes the character face down-right and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_left

func queue_face_left() -> Callable

Makes the character face left and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_right

func queue_face_right() -> Callable

Makes the character face right and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_up

func queue_face_up() -> Callable

Makes the character face up and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_up_left

func queue_face_up_left() -> Callable

Makes the character face up-left and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_face_up_right

func queue_face_up_right() -> Callable

Makes the character face up-right and plays idle animation.

This method is intended to be used inside a queue() of instructions.


queue_fade_in

func queue_fade_in(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT) -> Callable

Gradually increases alpha to 1.0 over duration seconds. If set_enablement is true, enables the character when complete.

This method is intended to be used inside a queue() of instructions.


queue_fade_out

func queue_fade_out(duration: float, set_enablement: bool = false, trans = Tween.TransitionType.TRANS_LINEAR, ease = Tween.EaseType.EASE_IN_OUT) -> Callable

Gradually decreases alpha to 0.0 over duration seconds. If set_enablement is true, disables the character when complete.

This method is intended to be used inside a queue() of instructions.


queue_fade_to

func queue_fade_to(target_alpha: float, duration: float, set_enablement: bool = false) -> Callable

Gradually transitions alpha to target_alpha (clamped between 0.0 and 1.0) over duration seconds. If set_enablement is true, enables/disables based on final alpha (0.0 means disabled, anything else means enabled).

This method is intended to be used inside a queue() of instructions.


queue_grab

func queue_grab() -> Callable

Plays the grab animation and waits for grab_done, then returns to idle.

This method is intended to be used inside a queue() of instructions.


queue_halt_animation

func queue_halt_animation()

Immediately stops the current animation and switches to idle.

This method is intended to be used inside a queue() of instructions.


queue_idle

func queue_idle() -> Callable

Puts the character in idle state, playing its idle animation and flipping the sprite based on flips_when.

This method is intended to be used inside a queue() of instructions.


queue_ignore_walkable_areas

func queue_ignore_walkable_areas(new_value: bool) -> Callable

Sets ignore_walkable_areas to new_value.

This method is intended to be used inside a queue() of instructions.

Outside of queued execution, assign the new value directly to ignore_walkable_areas.


queue_lock_dialog_pos

func queue_lock_dialog_pos() -> Callable

Locks the dialog position at the current calculated screen position.

This method is intended to be used inside a queue() of instructions.


queue_pause_animation

func queue_pause_animation()

Pauses the current animation.

This method is intended to be used inside a queue() of instructions.


queue_play_animation

func queue_play_animation(animation_label: String, animation_fallback = "", blocking = false) -> Callable

Plays the animation_label animation, falling back to animation_fallback if not found.

This method is intended to be used inside a queue() of instructions.


queue_reset_dialog_pos_offset

func queue_reset_dialog_pos_offset() -> Callable

Resets the dialog position offset to Vector2.ZERO.

This method is intended to be used inside a queue() of instructions.


queue_reset_dialog_pos_override

func queue_reset_dialog_pos_override() -> Callable

Resets the dialog position override to Vector2.INF (disabled).

This method is intended to be used inside a queue() of instructions.


queue_resume_animation

func queue_resume_animation()

Resumes the paused animation.

This method is intended to be used inside a queue() of instructions.


queue_say

func queue_say(dialog: String, emo = EMPTY_STRING) -> Callable

Makes the character say dialog, optionally with emotion emo. Plays the talk animation and an optional voice cue if defined for the emotion. Emits character_spoke that carries the character and the dialog line. This method is intended to be used inside a queue() of instructions.


queue_set_animation_prefix

func queue_set_animation_prefix(new_prefix: String) -> Callable

Sets animation_prefix to new_prefix.

This method is intended to be used inside a queue() of instructions.

Outside of queued execution, assign the new value directly to animation_prefix.


queue_set_emotion

func queue_set_emotion(new_emotion: String) -> Callable

Sets emotion to new_emotion.

This method is intended to be used inside a queue() of instructions.

Outside of queued execution, assign the new value directly to emotion.


queue_set_idle_animation

func queue_set_idle_animation(new_name: String) -> Callable

Sets idle_animation to new_name.

This method is intended to be used inside a queue() of instructions.

Outside of queued execution, assign the new value directly to idle_animation.


queue_set_talk_animation

func queue_set_talk_animation(new_name: String) -> Callable

Sets talk_animation to new_name.

This method is intended to be used inside a queue() of instructions.

Outside of queued execution, assign the new value directly to talk_animation.


queue_set_walk_animation

func queue_set_walk_animation(new_name: String) -> Callable

Sets walk_animation to new_name.

This method is intended to be used inside a queue() of instructions.

Outside of queued execution, assign the new value directly to walk_animation.


queue_stop_animation

func queue_stop_animation()

Stops the current looping animation (except idle) after its current loop finishes.

This method is intended to be used inside a queue() of instructions.


queue_stop_walking

func queue_stop_walking() -> Callable

Stops the character's movement and emits stopped_walk.

This method is intended to be used inside a queue() of instructions.


queue_unlock_dialog_pos

func queue_unlock_dialog_pos() -> Callable

Unlocks the dialog position, returning to normal positioning.

This method is intended to be used inside a queue() of instructions.


queue_walk

func queue_walk(target_pos: Vector2) -> Callable

Makes the character walk to target_pos, playing its walk animation and flipping the sprite based on flips_when.

This method is intended to be used inside a queue() of instructions.


queue_walk_to

func queue_walk_to(pos: Vector2) -> Callable

Makes the character walk to pos in the current room.

This method is intended to be used inside a queue() of instructions.


queue_walk_to_clicked

func queue_walk_to_clicked(offset = Vector2.ZERO) -> Callable

Makes the character walk (non-blocking) to the last clicked PopochiuClickable. You can set an offset relative to the target position.

If the user clicks elsewhere during the walk, the action is cancelled.

This method is intended to be used inside a queue() of instructions.


queue_walk_to_clicked_blocking

func queue_walk_to_clicked_blocking(offset = Vector2.ZERO) -> Callable

Makes the character walk (blocking the GUI) to the last clicked PopochiuClickable. You can set an offset relative to the target position.

When the GUI is blocked, the user can't click elsewhere to cancel the action.

This method is intended to be used inside a queue() of instructions.


queue_walk_to_hotspot

func queue_walk_to_hotspot(id: String, offset = Vector2.ZERO) -> Callable

Makes the character walk to the PopochiuHotspot with matching id. You can set an offset relative to the target position.

This method is intended to be used inside a queue() of instructions.


queue_walk_to_marker

func queue_walk_to_marker(id: String, offset = Vector2.ZERO) -> Callable

Makes the character walk to the Marker2D with matching id. You can set an offset relative to the target position.

This method is intended to be used inside a queue() of instructions.


queue_walk_to_prop

func queue_walk_to_prop(id: String, offset = Vector2.ZERO) -> Callable

Makes the character walk to the PopochiuProp with matching id. You can set an offset relative to the target position.

This method is intended to be used inside a queue() of instructions.


reset_animation_prefix

func reset_animation_prefix() -> void

Resets the animation prefix. Same as assigning an empty string to the prefix.


reset_buffered_position

func reset_buffered_position() -> void

Resets the buffered position. Called when exiting rooms to clean character state.


reset_dialog_pos_offset

func reset_dialog_pos_offset() -> void

Resets the dialog position offset to Vector2.ZERO.


reset_dialog_pos_override

func reset_dialog_pos_override() -> void

Resets the dialog position override to Vector2.ZERO (disabled).


resume_animation

func resume_animation()

Resumes the paused animation.


say

func say(dialog: String, emo = EMPTY_STRING) -> void

Makes the character say dialog, optionally with emotion emo. Plays the talk animation and an optional voice cue if defined for the emotion. Emits character_spoke that carries the character and the dialog line.


set_alpha

func set_alpha(value: float) -> void

set_animation_prefix

func set_animation_prefix(value: String) -> void

set_avatars

func set_avatars(value: Array) -> void

set_idle_animation

func set_idle_animation(value: String) -> void

set_obstacle

func set_obstacle(value: bool) -> void

set_talk_animation

func set_talk_animation(value: String) -> void

set_voices

func set_voices(value: Array) -> void

set_walk_animation

func set_walk_animation(value: String) -> void

start_facing_character

func start_facing_character(character: Variant = null) -> void

Makes this character start facing the specified character. If character is not provided, the character defined in face_character will be used. If that is also empty, the player character will be used. character can be a PopochiuCharacter instance or a String with the character's script_name.


start_following_character

func start_following_character(character: Variant = null) -> void

Makes this character start following the specified character. The follower will continuously monitor the leader's position and start moving when the leader exceeds the threshold distance (see follow_character_threshold). The follower will walk to a position offset from the leader as defined by follow_character_offset.

If character is not provided, the character defined in follow_character will be used. If that is also empty, the player character will be used. character can be a PopochiuCharacter instance or a String with the character's script_name.

The follower will only start a new walk when not already moving, preventing jitter from constant re-targeting.


stop_animation

func stop_animation()

Stops the current looping animation (except idle) after its current loop finishes.


stop_facing_character

func stop_facing_character() -> void

Makes this character stop facing another character.


stop_following_character

func stop_following_character() -> void

Makes this character stop following another character.


stop_walking

func stop_walking() -> void

Stops the character's movement and emits stopped_walk.


sync_buffered_position

func sync_buffered_position() -> void

Syncs the buffered position with the current position to avoid conflicts with walking.


turn_towards

func turn_towards(target_pos: Vector2) -> void

unlock_dialog_pos

func unlock_dialog_pos() -> void

Unlocks the dialog position, returning to normal positioning behavior.


update_position

func update_position() -> void

Forces the character's transformer position to match the buffered one, if available.


update_scale

func update_scale()

Updates the scale of the character, depending on the properties of the scaling region where the character is currently located.


walk

func walk(target_pos: Vector2) -> void

Makes the character walk to target_pos, playing its walk animation and flipping the sprite based on flips_when.


walk_to

func walk_to(pos: Vector2) -> void

Makes the character walk to pos in the current room.


walk_to_clicked

func walk_to_clicked(offset = Vector2.ZERO) -> void

Makes the character walk (non-blocking) to the last clicked PopochiuClickable. You can set an offset relative to the target position.

If the user clicks elsewhere during the walk, the action is cancelled.


walk_to_clicked_blocking

func walk_to_clicked_blocking(offset = Vector2.ZERO) -> void

Makes the character walk (blocking the GUI) to the last clicked PopochiuClickable. You can set an offset relative to the target position.

When the GUI is blocked, the user can't click elsewhere to cancel the action.


walk_to_hotspot

func walk_to_hotspot(id: String, offset = Vector2.ZERO) -> void

Makes the character walk to the PopochiuHotspot with matching id. You can set an offset relative to the target position.


walk_to_marker

func walk_to_marker(id: String, offset = Vector2.ZERO) -> void

Makes the character walk to the Marker2D with matching id. You can set an offset relative to the target position.


walk_to_prop

func walk_to_prop(id: String, offset = Vector2.ZERO) -> void

Makes the character walk to the PopochiuProp with matching id. You can set an offset relative to the target position.