Compare commits

..

4 Commits

12 changed files with 114 additions and 77 deletions

View File

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

View File

@ -196,6 +196,15 @@ func add_note(note: StickyNote) -> void:
notes.append(note) notes.append(note)
note.is_dragable = true 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 # Checks if a Node is currently inside the dropzone
func is_in_dropzone(to_check: Draggable) -> bool: func is_in_dropzone(to_check: Draggable) -> bool:

View File

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

View File

@ -15,6 +15,10 @@ func _ready():
super._ready() super._ready()
%SkipButton.pressed.connect(card_burned.emit) %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 ## Main play coroutine - simple linear flow for burning a card
func play() -> void: func play() -> void:
@ -37,6 +41,7 @@ func play() -> void:
# 3. Populate the 4 anchor slots with random cards # 3. Populate the 4 anchor slots with random cards
for ancor: Control in ancors: for ancor: Control in ancors:
var card: Card = stack.pop_front() var card: Card = stack.pop_front()
assert(card, "Not enough cards collected.")
cards.append(card) cards.append(card)
ancor.add_child(card) ancor.add_child(card)
print_debug("CardBurner: Added card '%s' to anchor" % card.name) print_debug("CardBurner: Added card '%s' to anchor" % card.name)
@ -57,8 +62,10 @@ func play() -> void:
func handle_hover(card: Draggable) -> void: func handle_hover(card: Draggable) -> void:
if _submitted: return
if not card is Card: return if not card is Card: return
selection = cards.find(card) selection = cards.find(card)
cursor.gamepad_mode = false
func handle_mouse_button(event: InputEventMouseButton, card: Card) -> void: 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): func _submit(card : Card):
_submitted = true _submitted = true
%ActionPrompt.visible = false
%SkipButton.visible = false %SkipButton.visible = false
await card.torch() await card.torch()
card_burned.emit() card_burned.emit()
@ -107,6 +116,7 @@ var selection: int:
card.highlighted = (selection == i) card.highlighted = (selection == i)
card.burn_state = Card.burned.SINGED if card.highlighted else Card.burned.NOT card.burn_state = Card.burned.SINGED if card.highlighted else Card.burned.NOT
if card.highlighted: if card.highlighted:
cursor.show()
cursor.gamepad_target = card.global_position + Vector2(-120, 150) cursor.gamepad_target = card.global_position + Vector2(-120, 150)
@ -118,11 +128,13 @@ func handle_direction_input(direction: Vector2) -> void:
match direction: match direction:
Vector2.UP: Vector2.UP:
cursor.show()
focus_cards = true focus_cards = true
cursor.visible = true cursor.visible = true
%SkipButton.release_focus() %SkipButton.release_focus()
selection = selection selection = selection
Vector2.DOWN: Vector2.DOWN:
cursor.hide()
focus_cards = false focus_cards = false
cursor.visible = false cursor.visible = false
%SkipButton.grab_focus() %SkipButton.grab_focus()
@ -132,5 +144,3 @@ func handle_direction_input(direction: Vector2) -> void:
Vector2.RIGHT: Vector2.RIGHT:
focus_cards = true focus_cards = true
selection += 1 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="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="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="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"] [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"] [sub_resource type="InputEventKey" id="InputEventKey_ckmi5"]
@ -27,25 +26,13 @@ length = 0.001
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("../../Sprite2D:self_modulate") tracks/0/path = NodePath("../../CandleCursor:color")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"update": 0, "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)] "values": [Color(1, 1, 1, 1)]
} }
@ -54,22 +41,10 @@ resource_name = "vanish"
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("../../Sprite2D:self_modulate") tracks/0/path = NodePath("../../CandleCursor:color")
tracks/0/interp = 2 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { 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), "times": PackedFloat32Array(0.69, 1),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
@ -90,15 +65,22 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_copuj") 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="."] [node name="Control" type="Control" parent="."]
layout_mode = 2 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"] [node name="Label" type="Label" parent="Control"]
layout_mode = 1 layout_mode = 1
anchors_preset = 7 anchors_preset = 7
@ -185,13 +167,7 @@ text = "Keep all thoughts"
[node name="CandleCursor" parent="." instance=ExtResource("3_l4ogr")] [node name="CandleCursor" parent="." instance=ExtResource("3_l4ogr")]
unique_name_in_owner = true 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)
scale = Vector2(100, 100)
texture = ExtResource("4_ckmi5")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Control/HSplitContainer") root_node = NodePath("../Control/HSplitContainer")

View File

@ -65,7 +65,7 @@ func expand() -> void:
func collapse() -> void: func collapse() -> void:
if not shown: return #TODO: test if not shown: return
shown = false shown = false
if tween and tween.is_valid(): tween.kill() if tween and tween.is_valid(): tween.kill()
tween = create_tween().set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_BACK) 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: func play_story() -> void:
# Check if this is a repeat playthrough # Check if this is a repeat playthrough
var repeat := collected var repeat := collected
collected = true collected = true
canvas_layer.show() canvas_layer.show()
await playable.appear()
# Allow room to prepare for scene (e.g., play animations) # Allow room to prepare for scene (e.g., play animations)
await State.room.prepare_scene_start(playable.scene_id, repeat) 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? Scenes.end_sequence(playable.scene_id) # todo: maybe later?
# Hide the CanvasLayer when done # Hide the CanvasLayer when done
await playable.vanish()
canvas_layer.hide() canvas_layer.hide()
Scenes.player_enable.emit(true) Scenes.player_enable.emit(true)
@ -129,11 +131,12 @@ func play_story() -> void:
func play_board() -> void: func play_board() -> void:
canvas_layer.show() canvas_layer.show()
await playable.appear()
# Play the board (handles mouse visibility and waits for close) # Play the board (handles mouse visibility and waits for close)
await playable.play() await playable.play()
# Hide the CanvasLayer when done await playable.vanish()
canvas_layer.hide() canvas_layer.hide()
Scenes.player_enable.emit(true) Scenes.player_enable.emit(true)
@ -142,19 +145,18 @@ func play_board() -> void:
func play_burner() -> void: func play_burner() -> void:
canvas_layer.show() 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() await playable.play()
# Hide the CanvasLayer when done await playable.vanish()
canvas_layer.hide() canvas_layer.hide()
func interact() -> void: func interact() -> void:
Scenes.player_enable.emit(false) Scenes.player_enable.emit(false)
shown = false
await collapse() await collapse()
collected = true
# collapse other interactables BEFORE showing canvas # collapse other interactables BEFORE showing canvas
get_tree().call_group("interactables", "collapse") get_tree().call_group("interactables", "collapse")

View File

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

View File

@ -2,7 +2,7 @@
class_name Playable class_name Playable
func _ready() -> void: func _ready() -> void:
pass hide()
## Awaitable that encapsulates the core interaction with this Playable ## Awaitable that encapsulates the core interaction with this Playable
func play() -> void: func play() -> void:
@ -12,3 +12,18 @@ func play() -> void:
func handle_hover(_area: Draggable): func handle_hover(_area: Draggable):
#prints("Playable[base].handle_hover", _area, _area.name) #prints("Playable[base].handle_hover", _area, _area.name)
pass 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() credits_roll.hide()
main_menu.hide() main_menu.hide()
pause_menu.hide() pause_menu.hide()
curtain.hide()
AppState.PAUSE: AppState.PAUSE:
credits_roll.hide() credits_roll.hide()
main_menu.hide() main_menu.hide()
@ -76,7 +75,7 @@ func start_game(save: SaveGame) -> void:
await State.room.play() await State.room.play()
func _load_room(next_path: String) -> bool: func _load_room(next_path: String) -> bool:
await curtain.show() await curtain.close()
%Loading.play() %Loading.play()
if State.room != null: if State.room != null:
@ -95,7 +94,6 @@ func _load_room(next_path: String) -> bool:
await get_tree().process_frame await get_tree().process_frame
await State.room.get_ready() await State.room.get_ready()
%Loading.stop() %Loading.stop()
await curtain.hide()
return true return true
ResourceLoader.THREAD_LOAD_FAILED: ResourceLoader.THREAD_LOAD_FAILED:
push_error("Failed to load room.") push_error("Failed to load room.")

View File

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

View File

@ -5,22 +5,31 @@ var _tween : Tween = null
func _ready() -> void: func _ready() -> void:
print_debug("curtain.gd: ready()") print_debug("curtain.gd: ready()")
show() visible = true
func show() -> void: ## Conceals the Game Stage
func close() -> void:
visible = true visible = true
print_debug("curtain.gd: show()") print_debug("curtain.gd: show()")
if _tween != null: if _tween: _tween.kill()
_tween.kill()
_tween = create_tween() _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 await _tween.finished
func hide() -> void: ## Conceals the Game Stage
print_debug("curtain.gd: hide()") func black() -> void:
if _tween != null: visible = true
_tween.kill() print_debug("curtain.gd: show()")
if _tween: _tween.kill()
_tween = create_tween() _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 await _tween.finished
visible = false visible = false

View File

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