Compare commits

..

4 Commits

12 changed files with 114 additions and 77 deletions

View File

@ -11,6 +11,8 @@ func start_room():
%UI.show()
$logic/PlayerController.process_mode = Node.PROCESS_MODE_INHERIT
await Main.curtain.open()
if not Scenes.is_sequence_repeating(Scenes.id.YOUTH_DRAVEN):
# Play intro scene directly (not triggered by CollectableUi)
await _play_intro_scene()

View File

@ -196,6 +196,15 @@ func add_note(note: StickyNote) -> void:
notes.append(note)
note.is_dragable = true
func appear():
await Main.curtain.close()
show()
await Main.curtain.open()
func vanish():
await Main.curtain.close()
hide()
await Main.curtain.open()
# Checks if a Node is currently inside the dropzone
func is_in_dropzone(to_check: Draggable) -> bool:

View File

@ -147,8 +147,8 @@ _data = {
}
[node name="board" type="PanelContainer"]
z_index = -10
material = SubResource("ShaderMaterial_ttqei")
clip_contents = true
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0

View File

@ -15,6 +15,10 @@ func _ready():
super._ready()
%SkipButton.pressed.connect(card_burned.emit)
func vanish():
super.vanish()
await Main.curtain.black() # Go straight to loading screen
await Main.curtain.close() # Go straight to loading screen
## Main play coroutine - simple linear flow for burning a card
func play() -> void:
@ -37,6 +41,7 @@ func play() -> void:
# 3. Populate the 4 anchor slots with random cards
for ancor: Control in ancors:
var card: Card = stack.pop_front()
assert(card, "Not enough cards collected.")
cards.append(card)
ancor.add_child(card)
print_debug("CardBurner: Added card '%s' to anchor" % card.name)
@ -57,8 +62,10 @@ func play() -> void:
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:
@ -67,7 +74,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()
@ -107,6 +116,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)
@ -118,11 +128,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()
@ -132,5 +144,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

@ -1,9 +1,8 @@
[gd_scene load_steps=13 format=3 uid="uid://g2a27jwdapai"]
[gd_scene load_steps=12 format=3 uid="uid://g2a27jwdapai"]
[ext_resource type="Script" uid="uid://bbia2hcdwctyn" path="res://logic-scenes/card_burner/card_burner.gd" id="1_copuj"]
[ext_resource type="Texture2D" uid="uid://615hvpuiacvm" path="res://addons/input_prompts/icons/xbox/X.png" id="3_ckmi5"]
[ext_resource type="PackedScene" uid="uid://uc6urpgv7n1y" path="res://logic-scenes/card_burner/cursor_candle.tscn" id="3_l4ogr"]
[ext_resource type="Texture2D" uid="uid://dwerd76p42ac" path="res://logic-scenes/card_burner/burner_gradient.tres" id="4_ckmi5"]
[ext_resource type="Script" uid="uid://bbs1u7ojno7xo" path="res://addons/input_prompts/action_prompt/action_prompt.gd" id="4_x6cxt"]
[sub_resource type="InputEventKey" id="InputEventKey_ckmi5"]
@ -27,25 +26,13 @@ length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../../Sprite2D:self_modulate")
tracks/0/path = NodePath("../../CandleCursor:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../../CandleCursor:color")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
@ -54,22 +41,10 @@ resource_name = "vanish"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../../Sprite2D:self_modulate")
tracks/0/interp = 2
tracks/0/path = NodePath("../../CandleCursor:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../../CandleCursor:color")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.69, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
@ -90,15 +65,22 @@ grow_horizontal = 2
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)
[node name="Control" type="Control" parent="."]
layout_mode = 2
[node name="ColorRect" type="ColorRect" parent="Control"]
show_behind_parent = true
custom_minimum_size = Vector2(8192, 8192)
layout_mode = 0
offset_left = -4096.0
offset_top = -4096.0
offset_right = 4096.0
offset_bottom = 4096.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 0.6745098)
[node name="Label" type="Label" parent="Control"]
layout_mode = 1
anchors_preset = 7
@ -185,13 +167,7 @@ text = "Keep all thoughts"
[node name="CandleCursor" parent="." instance=ExtResource("3_l4ogr")]
unique_name_in_owner = true
position = Vector2(989, 1068)
[node name="Sprite2D" type="Sprite2D" parent="."]
self_modulate = Color(1, 1, 1, 0)
position = Vector2(954.99994, 545)
scale = Vector2(100, 100)
texture = ExtResource("4_ckmi5")
position = Vector2(1007, 1449)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Control/HSplitContainer")

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)
@ -101,9 +101,10 @@ func _input(event: InputEvent) -> void:
func play_story() -> void:
# Check if this is a repeat playthrough
var repeat := collected
collected = true
canvas_layer.show()
await playable.appear()
# Allow room to prepare for scene (e.g., play animations)
await State.room.prepare_scene_start(playable.scene_id, repeat)
@ -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)
@ -129,11 +131,12 @@ func play_story() -> void:
func play_board() -> void:
canvas_layer.show()
await playable.appear()
# Play the board (handles mouse visibility and waits for close)
await playable.play()
# Hide the CanvasLayer when done
await playable.vanish()
canvas_layer.hide()
Scenes.player_enable.emit(true)
@ -142,19 +145,18 @@ func play_board() -> void:
func play_burner() -> void:
canvas_layer.show()
await playable.appear()
# Play the board (handles mouse visibility and waits for close)
# Play the burner mini-game, will actually send us to the next map
await playable.play()
# Hide the CanvasLayer when done
await playable.vanish()
canvas_layer.hide()
func interact() -> void:
Scenes.player_enable.emit(false)
shown = false
await collapse()
collected = true
# collapse other interactables BEFORE showing canvas
get_tree().call_group("interactables", "collapse")

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,18 @@ func play() -> void:
func handle_hover(_area: Draggable):
#prints("Playable[base].handle_hover", _area, _area.name)
pass
const TRANSPARENT_BLACK := Color(0,0,0,0)
func appear():
self.modulate = TRANSPARENT_BLACK
show()
var tween := create_tween().set_ease(Tween.EASE_IN)
tween.tween_property(self, "modulate", Color.WHITE, 0.3)
await tween.finished
func vanish():
var tween := create_tween().set_ease(Tween.EASE_OUT)
tween.tween_property(self, "modulate", TRANSPARENT_BLACK, 0.3)
await tween.finished
hide()

View File

@ -39,7 +39,6 @@ var app_state: AppState = AppState.BOOT:
credits_roll.hide()
main_menu.hide()
pause_menu.hide()
curtain.hide()
AppState.PAUSE:
credits_roll.hide()
main_menu.hide()
@ -76,7 +75,7 @@ func start_game(save: SaveGame) -> void:
await State.room.play()
func _load_room(next_path: String) -> bool:
await curtain.show()
await curtain.close()
%Loading.play()
if State.room != null:
@ -95,7 +94,6 @@ func _load_room(next_path: String) -> bool:
await get_tree().process_frame
await State.room.get_ready()
%Loading.stop()
await curtain.hide()
return true
ResourceLoader.THREAD_LOAD_FAILED:
push_error("Failed to load room.")

View File

@ -83,8 +83,16 @@ fill = 1
fill_from = Vector2(0.538462, 0.491453)
fill_to = Vector2(1.3, -0.3)
[node name="main" type="Node"]
[node name="main" type="Control"]
process_mode = 3
z_index = 110
z_as_relative = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_rqkns")
youth_room_path = "uid://b3b0gyvklqn50"
transition_room_path = "uid://fgp3s28h7msy"
@ -92,29 +100,38 @@ adulthood_room_path = "uid://flisupth27th"
[node name="Curtain" parent="." instance=ExtResource("2_nbcxq")]
unique_name_in_owner = true
z_index = -1
layout_mode = 1
[node name="Loading" parent="." instance=ExtResource("5_dxvjq")]
unique_name_in_owner = true
layout_mode = 1
offset_bottom = 0.0
[node name="MainMenu" parent="." instance=ExtResource("3_ik73t")]
unique_name_in_owner = true
visible = false
z_index = 10
layout_mode = 1
[node name="FPSLabel" type="Label" parent="."]
visible = false
layout_mode = 0
offset_right = 40.0
offset_bottom = 35.0
script = SubResource("GDScript_8sq0u")
[node name="Startup Menu" parent="." instance=ExtResource("1_v5rpm")]
visible = false
layout_mode = 1
[node name="Disclaimer" parent="." instance=ExtResource("7_t45fc")]
visible = false
layout_mode = 1
[node name="PauseContainer" type="CenterContainer" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@ -191,6 +208,7 @@ text = "Skip this Story"
unique_name_in_owner = true
visible = false
modulate = Color(1, 1, 1, 0)
layout_mode = 1
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
bus = &"music"

View File

@ -5,22 +5,31 @@ var _tween : Tween = null
func _ready() -> void:
print_debug("curtain.gd: ready()")
show()
visible = true
func show() -> void:
## Conceals the Game Stage
func close() -> void:
visible = true
print_debug("curtain.gd: show()")
if _tween != null:
_tween.kill()
if _tween: _tween.kill()
_tween = create_tween()
_tween.tween_property(self, "modulate:a", 1.0, 1.0)
_tween.tween_property(self, "modulate", Color.WHITE, 0.7)
await _tween.finished
func hide() -> void:
print_debug("curtain.gd: hide()")
if _tween != null:
_tween.kill()
## Conceals the Game Stage
func black() -> void:
visible = true
print_debug("curtain.gd: show()")
if _tween: _tween.kill()
_tween = create_tween()
_tween.tween_property(self, "modulate:a", 0.0, 1.0)
_tween.tween_property(self, "modulate", Color.BLACK, 0.7)
await _tween.finished
## Makes the Game Stage Visible
func open() -> void:
print_debug("curtain.gd: hide()")
if _tween: _tween.kill()
_tween = create_tween()
_tween.tween_property(self, "modulate", Color.TRANSPARENT, 0.7)
await _tween.finished
visible = false

View File

@ -41,6 +41,7 @@ _data = {
}
[node name="Loading" type="Control"]
z_index = -5
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0