-
-
Notifications
You must be signed in to change notification settings - Fork 19
Character
Each character you create will have its own script file (based on CharacterTemplate.gd). This is created with the name you give the character in the Create character popup prefixed by Character: E.g. CharacterGlottis.gd, CharacterTrapusin.gd, CharacterManny.gd.
- on_interact() void
Called when "popochiu-interact" (set to Left Mouse Button in the project's Input Map) is used on the character. E.g. You can use it to make the character react to players interaction.
By default this calls to
.on_interact()
. In case you don't overwrite this, it will use the default PopochiuClickable.gd on_interact() call, which shows a game message.
func on_interact() -> void:
yield(E.run([
C.walk_to_clicked(), # The PC walks to the clicked character
'Player: Hi.',
'Glottis: Hi Manny.', # The clicked character responds
'Glottis: What do you want now?.'
]), 'completed')
D.show_dialog('ChatWithGlottis') # A branching dialog starts
- on_look() void
Called when "popochiu-look" (set to Right Mouse Button in the project's Input Map) is used on the character. E.g. You can use it to make the character react to players looking interaction.
By default this calls to
.on_look()
. In case you don't overwrite this, it will use the default PopochiuClickable.gd on_look() call, which shows a game message.
func on_look() -> void:
E.run([
C.face_clicked(),
'Player: It is really small.',
"Player: I can't believe Glottis fits in there."
])
-
on_item_used( PopochiuInventoryItem
item
) void
Called when an inventory item is used on the character. Use the script_name
property of item
to see which was used.
By default this calls to
.on_item_used(item)
. In case you don't overwrite this, it will use the default PopochiuClickable.gd on_item_used(item: PopochiuInventoryItem) call, which shows a game message.
func on_item_used(item: PopochiuInventoryItem) -> void:
if item.script_name == 'DenturesWithTeethCopy':
yield(E.run([
'Eva: Manny, this looks like a perfect impression of your teeth.',
'Eva: We can use this as a mold to make a fake set of teeth...',
'Player: Good work soldier'
]), 'completed')
E.goto_room('ToPetrifiedForestCinematic')
- play_grab() void
Use it to play the grab animation of the character.
func play_grab() -> void:
if _looking_dir == Looking.LEFT:
$AnimatedSprite.play('grab')
else:
$AnimatedSprite.play('grab_right')
- play_idle() void
Use it to play the idle animation of the character.
func play_idle() -> void:
$AnimationPlayer.play('idle')
- play_talk() void
Use it to play the talk animation of the character.
func play_talk() -> void:
if emotion == 'scared':
$AnimatedSprite.play('talk_scared')
else:
$AnimatedSprite.play('talk')
-
play_walk( Vector2
target_pos
) void
Use it to play the walk animation of the character.
func play_walk(target_pos: Vector2) -> void:
_looking_dir = _calculate_looking_dir(target_pos)
$AnimationPlayer.play('walk_' + _get_dir_name(_looking_dir))
func _calculate_looking_dir(pos: Vector2) -> int:
...
func _get_dir_name(dir: int) -> String:
return ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'][dir]