-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Flip dialog portrait avatar based on character direction #298
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,11 @@ extends PopochiuDialogText | |
@onready var right_avatar_container: PanelContainer = %RightAvatarContainer | ||
@onready var right_avatar: TextureRect = %RightAvatar | ||
|
||
const _LOOKING_LEFT_DIRS := [ | ||
PopochiuCharacter.Looking.LEFT, | ||
PopochiuCharacter.Looking.UP_LEFT, | ||
PopochiuCharacter.Looking.DOWN_LEFT, | ||
] | ||
|
||
#region Godot ###################################################################################### | ||
func _ready() -> void: | ||
|
@@ -30,12 +35,16 @@ func _update_avatar(chr: PopochiuCharacter, _msg := '') -> void: | |
E.scale if E.settings.scale_gui else Vector2.ONE | ||
) | ||
|
||
var flip_h := _LOOKING_LEFT_DIRS.has(chr._looking_dir) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, I guess that's very legacy code that nobody touched in a while. Nice spot! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right @edmundito . We can make that property public (by removing the underscore at the beggining) or use getter/setter methods. I prefer the first option. Changing that will also affect the |
||
|
||
if char_pos.x <= E.half_width: | ||
left_avatar_container.modulate.a = 1.0 | ||
left_avatar.texture = chr.get_avatar_for_emotion(chr.emotion) | ||
left_avatar.flip_h = flip_h | ||
else: | ||
right_avatar_container.modulate.a = 1.0 | ||
right_avatar.texture = chr.get_avatar_for_emotion(chr.emotion) | ||
right_avatar.flip_h = flip_h | ||
|
||
|
||
func _set_default_size() -> void: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following Godot's style guide, constants should be defined without underscore on the first character.