fix: overlapping animations in different playables

This commit is contained in:
tiger tiger tiger 2026-01-18 21:23:37 +01:00
parent 3ed8896d3b
commit 517b1812ec
5 changed files with 35 additions and 18 deletions

View File

@ -43,6 +43,8 @@ func play() -> void:
print("CardBurner: ", len(cards))
await appear()
# 4. Wait for player to burn a card (or skip)
print_debug("CardBurner: Waiting for player to burn a card...")
handle_direction_input(Vector2.UP)
@ -54,12 +56,14 @@ func play() -> void:
await $AnimationPlayer.animation_finished
print_debug("CardBurner: Sequence complete")
await vanish()
func handle_hover(card: Draggable) -> void:
if _submitted: return
if not card is Card: return
selection = cards.find(card)
cursor.gamepad_mode = false
func handle_mouse_button(event: InputEventMouseButton, card: Card) -> void:
@ -68,7 +72,9 @@ func handle_mouse_button(event: InputEventMouseButton, card: Card) -> void:
func _submit(card : Card):
_submitted = true
%ActionPrompt.visible = false
%SkipButton.visible = false
await card.torch()
card_burned.emit()
@ -108,6 +114,7 @@ var selection: int:
card.highlighted = (selection == i)
card.burn_state = Card.burned.SINGED if card.highlighted else Card.burned.NOT
if card.highlighted:
cursor.show()
cursor.gamepad_target = card.global_position + Vector2(-120, 150)
@ -119,11 +126,13 @@ func handle_direction_input(direction: Vector2) -> void:
match direction:
Vector2.UP:
cursor.show()
focus_cards = true
cursor.visible = true
%SkipButton.release_focus()
selection = selection
Vector2.DOWN:
cursor.hide()
focus_cards = false
cursor.visible = false
%SkipButton.grab_focus()
@ -133,5 +142,3 @@ func handle_direction_input(direction: Vector2) -> void:
Vector2.RIGHT:
focus_cards = true
selection += 1
if not focus_cards: cursor.gamepad_target += Vector2(0, 50)

View File

@ -91,10 +91,9 @@ grow_vertical = 2
script = ExtResource("1_copuj")
[node name="ColorRect" type="ColorRect" parent="."]
visible = false
custom_minimum_size = Vector2(8192, 8192)
layout_mode = 2
color = Color(0, 0, 0, 0.3137255)
color = Color(0, 0, 0, 0.5019608)
[node name="Control" type="Control" parent="."]
layout_mode = 2
@ -185,11 +184,11 @@ text = "Keep all thoughts"
[node name="CandleCursor" parent="." instance=ExtResource("3_l4ogr")]
unique_name_in_owner = true
position = Vector2(989, 1068)
position = Vector2(1007, 1449)
[node name="Sprite2D" type="Sprite2D" parent="."]
self_modulate = Color(1, 1, 1, 0)
position = Vector2(954.99994, 545)
position = Vector2(955, 545)
scale = Vector2(100, 100)
texture = ExtResource("4_ckmi5")

View File

@ -65,7 +65,7 @@ func expand() -> void:
func collapse() -> void:
if not shown: return #TODO: test
if not shown: return
shown = false
if tween and tween.is_valid(): tween.kill()
tween = create_tween().set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_BACK)
@ -111,6 +111,7 @@ func play_story() -> void:
Scenes.begin_sequence(playable.scene_id)
# Play the story
await playable.appear()
await playable.play()
# Pick the cards if not already picked
@ -121,6 +122,7 @@ func play_story() -> void:
Scenes.end_sequence(playable.scene_id) # todo: maybe later?
# Hide the CanvasLayer when done
await playable.vanish()
canvas_layer.hide()
Scenes.player_enable.emit(true)
@ -152,7 +154,6 @@ func play_burner() -> void:
func interact() -> void:
Scenes.player_enable.emit(false)
shown = false
await collapse()
collected = true

View File

@ -120,17 +120,11 @@ func try_scroll():
##tween.set_trans()
scroll_target = forward_target
func play():
print_debug("StoryPlayable.gd: %s.play()" % self.name)
# There's an ugly glitch here.
func appear():
hide()
animation_player.play("RESET")
await animation_player.animation_finished
# Show ourselves before playing
get_parent().show() # Ensure visible Canvaslayer!
scroll_target = 0
# FIXME: find out why this needs to be set to prevent scenes from being fully revealed
@ -145,7 +139,11 @@ func play():
# Wait and get ready.
await get_tree().process_frame
show()
await super.appear()
func play():
print_debug("StoryPlayable.gd: %s.play()" % self.name)
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
# FIXME: Don't know how to do this.
@ -168,7 +166,6 @@ func play():
await skip_control.proceed
animation_player.play("vanish")
await animation_player.animation_finished
finished.emit()

View File

@ -2,7 +2,7 @@
class_name Playable
func _ready() -> void:
pass
hide()
## Awaitable that encapsulates the core interaction with this Playable
func play() -> void:
@ -12,3 +12,16 @@ func play() -> void:
func handle_hover(_area: Draggable):
#prints("Playable[base].handle_hover", _area, _area.name)
pass
func appear():
self.modulate = Color.TRANSPARENT
show()
var tween := create_tween().set_ease(Tween.EASE_IN)
tween.tween_property(self, "modulate", Color.WHITE, 1.5)
await tween.finished
func vanish():
var tween := create_tween().set_ease(Tween.EASE_OUT)
tween.tween_property(self, "modulate", Color.TRANSPARENT, 1.5)
await tween.finished
hide()