-
-
Notifications
You must be signed in to change notification settings - Fork 19
PopochiuCharacter
Inherits from PopochiuClickable.
Any Object that can move, walk, navigate rooms, have an inventory, etc.
When you select a PopochiuCharacter in the scene tree of a PopochiuRoom, you'll see this message. That means you won't be able to modify the PopochiuCharacter properties while in the room' scene, except for its position
. This is because that node instance will be deleted during runtime to be replaces by the one used globally by Popochiu.
You'll need to open the PopochiuCharacter' scene in order to modify its properties.
-
FlipsWhen
NONE = 0 --- The
$Sprite
child doesn't flips when moving.MOVING_RIGHT = 1 --- The
$Sprite
child flips (flip_h = true
) when the character is moving to the right.MOVING_LEFT = 2 --- The
$Sprite
child flips (flip_h = true
) when the character is moving to the left. -
Looking
UP = 0 --- Indicates the character is looking up.
UP_RIGHT = 0 --- Indicates the character is looking up and right.
RIGHT = 0 --- Indicates the character is looking to the right.
RIGHT_DOWN = 0 --- Indicates the character is looking down and right.
DOWN = 0 --- Indicates the character is looking down.
DOWN_LEFT = 0 --- Indicates the character is looking down and left.
LEFT = 0 --- Indicates the character is looking to the left.
UP_LEFT = 0 --- Indicates the character is looking up and left.
-
started_walk_to( PopochiuCharacter
character
, Vector2start
, Vector2end
). Emitted when the character starts walking. As parameter it sends itself, the starting position and the ending position. PopochiuRooms connect to this signal in order to make a character move inside the room fromstart
toend
. - stoped_walk. Emitted when the character stops walking.
-
can_move bool. Default
true
. Whether the character can or not move. -
flips_when FlipsWhen. Default
FlipsWhen.NONE
. When using the$Sprite
child to render the character, it will flip horizontally when this node moves to the left if the property is equal toFlipsWhen.LEFT
, it will flip when moving to the right if it is equal toFlipsWhen.RIGHT
. Set the value of this property toFlipsWhen.NONE
if you remove the$Sprite
child in order to use another node to render the character. -
follow_player bool. Default
false
. Whether the character should follor the player-controlled character when it moves through the room. -
ignore_walkable_areas bool. Default
false
. Whether the character ignores or not walkable areas. Iftrue
, the character will move to any point where players click without taking into account walkable areas. -
is_player bool. Default
false
. Whether the character is the one controller by the player. -
text_color Color. Default
Color.white
. The color in which the dialogue lines of the character are rendered. -
voices Array. Default
[]
. Array of Dictionary where each element has{ emotion = '', cue = '', variations = 0 }
. You can use it to define rules for playing audio cues when a character speaks with a specific emotion. Check this video for an example. -
walk_speed float. Default
200.0
. The speed at which the character will move. It is pixels per frame.
-
emotion String. Default
''
. The current emotion used by the character. -
is_moving bool. Default
false
. Whether the character is nor not moving. -
last_room String. Default
''
. Stores thescript_name
of the preiously visited PopochiuRoom.
-
_looking_dir Looking. Default
Looking.DOWN
. Used to know the direction the character is looking to.
🍑 For a detailed and exemplified description of all the virtual methods of this class (included those inherited from PopochiuClickable), go to the Your scripts > Character page.
-
play_grab() void
Use it to play the grab animation of the character.
-
play_idle() void
Use it to play the idle animation of the character.
-
play_talk() void
Use it to play the talk animation of the character.
-
play_walk( Vector2
target_pos
) voidUse it to play the walk animation of the character.
-
face_clicked( bool
is_in_queue = true
) voidMakes the character face left or right depending on the direction of the clicked PopochiuClickable stored in E.clicked. If you want to use it outside E.run(), send
is_in_queue
asfalse
. Can be yield. -
face_left( bool
is_in_queue = true
) voidSets
_looking_dir = Looking.LEFT
and yields untilidle()
is completed. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
face_right( bool
is_in_queue = true
) voidSets
_looking_dir = Looking.RIGHT
and yields untilidle()
is completed. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
face_up( bool
is_in_queue = true
) voidSets
_looking_dir = Looking.UP
and yields untilidle()
is completed. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
face_up_right( bool
is_in_queue = true
) voidSets
_looking_dir = Looking.UP_RIGHT
and yields untilidle()
is completed. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
face_down( bool
is_in_queue = true
) voidSets
_looking_dir = Looking.DOWN
and yields untilidle()
is completed. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
grab( bool
is_in_queue = true
) voidCalls
play_grab
and yields until thecharacter_grab_done
signal is emitted, then plays the idle animation. When running inside a cutscene (E.run_cutscene()), ignores the mentioned behavior if the cutscene is skipped. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
hide_helpers() void
Used by the plugin to hide the visual helpers that show the
baseline
andwalk_to_point
of the object in Godot´s 2D Canvas. It also hides the$DialogPos
child. -
idle( bool
is_in_queue = true
) voidCalls
playe_idle()
and then yields 0.2 seconds. When running inside a cutscene ( E.run_cutscene() ), ignores callingplay_idle()
if the cutscene is skipped. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
say( String
dialog
, boolis_in_queue = true
) voidCalls
play_talk()
and emits thecharacter_spoke
signal sending itself as parameter and thedialog
line to show on screen. If an audio cue is defined for the emotion set in the dialogue line, then it is played by callingA.play_no_block()
. When running inside a cutscene ( E.run_cutscene() ), it will ignore the previous mentioned instructions if the cutscene is skipped. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
show_helpers() void
Used by the plugin to make visible the visual helpers that show the
baseline
andwalk_to_point
of the object in Godot´s 2D Canvas. It also shows the$DialogPos
child. -
stop_walking( bool
is_in_queue = true
) voidMakes the character stop moving and emits the
stoped_walk
signal, then yields until the next frame. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
walk( Vector2
target_pos
, boolis_in_queue = true
) voidMakes
is_moving = true
and sets the value of_looking_dir
toLooking.LEFT
orLooking.RIGHT
depending on the movement direction calculated withtarget_pos
. It callsplay_walk()
, and after emitting thestarted_walk_to
signal, yields until thecharacter_move_ended
signal is triggered. When running inside a cutscene ( E.run_cutscene() ), ignores callingplay_walk()
if the cutscene is skipped, and also sets theposition
of the character totarget_pos
. If you want to use it outside E.run(), sendis_in_queue
asfalse
. Can be yield. -
walk_to( Vector2
pos
) voidMakes the character walk to a coordinate. Meant to be used in E.run(). Can be yield.
-
walk_to_hotspot( String
id
) voidMakes the character walk to the PopochiuHotspot (in the current room) which
script_name
is equal toid
. Meant to be used in E.run(). Can be yield. -
walk_to_prop( String
id
) voidMakes the character walk to the PopochiuProp (in the current room) which
script_name
is equal toid
. Meant to be used in E.run(). Can be yield. -
walk_to_room_point( String
id
) voidMakes the character walk to a room point (Position2D) (in the current room) which
name
is equal toid
. Meant to be used in E.run(). Can be yield.
-
get_dialog_pos() float
Returns the
y
position of the$DialogPos
child. Used by the graphic interface to calculate where to show the dialogue lines of the character. -
set_voices( Array
value
) voidCreates a Dictionary with
{ emotion = '', cue = '', variations = 0 }
each time a new element is added to thevoices
Array in the Inspector. This dictionaries can be used to define the rules to play a set of audio cues depending on the emotion of each dialogue line. Check this video for an example.
-
_get_vo_cue( String
emotion = ''
) StringReturn the
script_name
of the audio cue to play whensay()
is called. This will take into account the number of variations defined to pick a random cue name based on that. Check this video for an example. -
_translate() void
Makes the
description
take the value returned by E.get_text() sending thedescription_code
as parameter. This is used by the engine when translating the game in runtime.