Slight tweak to connector rendering.
This commit is contained in:
parent
ae34cb934a
commit
8e821ead28
1 changed files with 9 additions and 8 deletions
|
|
@ -44,12 +44,20 @@ func show_notification(weapon_name: String, player_node: Node2D, player_sprite_s
|
||||||
position.y = target_pos.y - 10.0
|
position.y = target_pos.y - 10.0
|
||||||
modulate.a = 0.0
|
modulate.a = 0.0
|
||||||
|
|
||||||
|
# Create connector line immediately so it fades in with the notification
|
||||||
|
_connector_line = Line2D.new()
|
||||||
|
_connector_line.default_color = Color(1.0, 1.0, 1.0, 0.0)
|
||||||
|
_connector_line.width = 1.0
|
||||||
|
add_child(_connector_line)
|
||||||
|
_connector_visible = true
|
||||||
|
|
||||||
# Pause following during fade-in so the tween isn't overridden by _process
|
# Pause following during fade-in so the tween isn't overridden by _process
|
||||||
_follow_player = false
|
_follow_player = false
|
||||||
|
|
||||||
# Fade in and slide into position with overshoot
|
# Fade in notification and connector together, slide into position with overshoot
|
||||||
var tween = create_tween().set_parallel()
|
var tween = create_tween().set_parallel()
|
||||||
tween.tween_property(self, "modulate:a", 1.0, 0.3)
|
tween.tween_property(self, "modulate:a", 1.0, 0.3)
|
||||||
|
tween.tween_property(_connector_line, "default_color:a", 1.0, 0.3)
|
||||||
var move_tween = tween.tween_property(self, "position:y", target_pos.y, 0.3)
|
var move_tween = tween.tween_property(self, "position:y", target_pos.y, 0.3)
|
||||||
move_tween.set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT)
|
move_tween.set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT)
|
||||||
|
|
||||||
|
|
@ -57,13 +65,6 @@ func show_notification(weapon_name: String, player_node: Node2D, player_sprite_s
|
||||||
await tween.finished
|
await tween.finished
|
||||||
_follow_player = true
|
_follow_player = true
|
||||||
|
|
||||||
# Create connector line from notification to player origin
|
|
||||||
_connector_line = Line2D.new()
|
|
||||||
_connector_line.default_color = Color.WHITE
|
|
||||||
_connector_line.width = 1.0
|
|
||||||
add_child(_connector_line)
|
|
||||||
_connector_visible = true
|
|
||||||
|
|
||||||
# Stay fully visible for a moment before fading
|
# Stay fully visible for a moment before fading
|
||||||
await get_tree().create_timer(0.5).timeout
|
await get_tree().create_timer(0.5).timeout
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue