class

PointClickEngine::Characters::Character

Inherits PointClickEngine::Characters::Talkable < PointClickEngine::Core::GameObject < PointClickEngine::Core::Drawable < Reference < Object

Character class using component-based architecture

This Character class delegates responsibilities to specialized components:

  • AnimationController: Handles all animation logic
  • SpriteController: Manages sprite loading and rendering
  • CharacterStateManager: Coordinates state transitions
  • MovementController: Handles movement and pathfinding
  • CharacterDialogue: Manages dialogue interactions

Constructors

new(name : String, position : RL::Vector2, size : RL::Vector2)

Creates a character with specified properties

Source
new

Creates a character with empty properties

Source

Instance methods

add_animation(name : String, start_frame : Int32, frame_count : Int32, frame_speed : Float32 = Core::GameConstants::DEFAULT_ANIMATION_SPEED, loop : Bool = true)

Defines a named animation for the character

Source
after_yaml_deserialize(ctx : YAML::ParseContext)

Called after YAML deserialization to restore runtime state

Source
animation_controller

Component Controllers

Source
animation_controller=(animation_controller : AnimationController)

Component Controllers

Source
animations(*args, **options)
Source
animations(*args, **options, &)
Source
ask(question : String, choices : Array(Tuple(String, Proc(Nil))))

Presents a dialogue question with multiple choice responses

Source
available?(*args, **options)
Source
available?(*args, **options, &)
Source
busy?(*args, **options)
Source
busy?(*args, **options, &)
Source
can_interact?(*args, **options)
Source
can_interact?(*args, **options, &)
Source
can_move?(*args, **options)

Convenience methods for state queries

Source
can_move?(*args, **options, &)

Convenience methods for state queries

Source
can_talk?(*args, **options)
Source
can_talk?(*args, **options, &)
Source
contains_point?(point : RL::Vector2) : Bool

Check if a point is within the character's bounds

Source
conversation_partner

Reference to character currently in conversation with (runtime only)

Source
conversation_partner=(conversation_partner : Character | Nil)

Reference to character currently in conversation with (runtime only)

Source
conversation_partner_name

Name of character currently in conversation with (for serialization)

Source
conversation_partner_name=(conversation_partner_name : String | Nil)

Name of character currently in conversation with (for serialization)

Source
current_animation(*args, **options)

Delegate animation properties to animation controller

Source
current_animation(*args, **options, &)

Delegate animation properties to animation controller

Source
current_path_index

Current waypoint index when following a path (runtime only)

Source
current_path_index=(current_path_index : Int32)

Current waypoint index when following a path (runtime only)

Source
description

Descriptive text shown when examining the character

Source
description=(description : String)

Descriptive text shown when examining the character

Source
dialogue_system(*args, **options)

Delegate dialogue methods to the dialogue system

Source
dialogue_system(*args, **options, &)

Delegate dialogue methods to the dialogue system

Source
dialogue_system_data

Dialogue system data for this character

Source
dialogue_system_data=(dialogue_system_data : Dialogue::CharacterDialogue | Nil)

Dialogue system data for this character

Source
direction(*args, **options)
Source
direction(*args, **options, &)
Source
direction=(arg)
Source
distance_to_target

Get remaining distance to movement target

Source
draw

Renders the character sprite and dialogue

Source
following_path?

Check if character is following a pathfinding route

Source
get_animation_controller

Component access methods for external systems

Source
get_sprite_controller
Source
get_state_manager
Source
has_animation?(name : String) : Bool

Convenience methods for animation control

Source
load_spritesheet(path : String, frame_width : Int32, frame_height : Int32)

Loads a spritesheet for character animation

Source
manual_scale

Manual scale override from configuration (overrides dynamic scaling)

Source
manual_scale=(manual_scale : Float32 | Nil)

Manual scale override from configuration (overrides dynamic scaling)

Source
mood(*args, **options)
Source
mood(*args, **options, &)
Source
mood=(arg)
Source
movement_controller
Source
movement_controller=(movement_controller : MovementController | Nil)
Source
moving?

Check if character is currently moving

Source
name

The character's unique name identifier

Source
name=(name : String)

The character's unique name identifier

Source
on_interact(interactor : Character)

Abstract methods that must be implemented by subclasses

Source
on_look
Source
on_movement_complete

Set movement completion callback

Source
on_talk
Source
on_walk_complete

Callback executed when character finishes walking (runtime only)

Source
on_walk_complete=(on_walk_complete : Proc(Nil) | Nil)

Callback executed when character finishes walking (runtime only)

Source
path

Pathfinding waypoints for navigation (runtime only)

Source
path=(path : Array(RL::Vector2) | Nil)

Pathfinding waypoints for navigation (runtime only)

Source
pause_animation
Source
play_animation(name : String, force_restart : Bool = true)

Plays a named animation

Source
reload_sprite_texture
Source
resume_animation
Source
say(text : String, &block : -> Nil)

Makes the character speak dialogue text

Source
set_manual_scale(scale : Float32 | Nil)

Sprite management convenience methods

Source
set_mood(new_mood : CharacterMood)

Sets the character's mood and updates mood-based animations

Source
sprite(*args, **options)

Delegate sprite properties to sprite controller

Source
sprite(*args, **options, &)

Delegate sprite properties to sprite controller

Source
sprite_controller
Source
sprite_controller=(sprite_controller : SpriteController)
Source
sprite_loaded?
Source
sprite_path(*args, **options)
Source
sprite_path(*args, **options, &)
Source
state(*args, **options)

Delegate state properties to state manager

Source
state(*args, **options, &)

Delegate state properties to state manager

Source
state=(arg)
Source
state_manager
Source
state_manager=(state_manager : CharacterStateManager)
Source
stop_animation
Source
stop_walking

Stops the character's movement immediately

Source
talking?(*args, **options)
Source
talking?(*args, **options, &)
Source
target_position

Target position for movement (nil if not moving)

Source
target_position=(target_position : RL::Vector2 | Nil)

Target position for movement (nil if not moving)

Source
update(dt : Float32)

Updates the character's state, movement, and animation

Source
use_pathfinding

Whether to use pathfinding for movement (true = smart navigation)

Source
use_pathfinding=(use_pathfinding : Bool)

Whether to use pathfinding for movement (true = smart navigation)

Source
walk_to(target : RL::Vector2, use_pathfinding : Bool | Nil = nil)

Initiates movement to a target position

Source
walk_to_with_path(path : Array(RL::Vector2))

Initiates movement along a predefined path

Source
walking_speed

Movement speed in pixels per second

Source
walking_speed=(walking_speed : Float32)

Movement speed in pixels per second

Source