diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index c6734d3..3d96b1a 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -1,23 +1,19 @@ # Attribution -## Collaborators + +Made by Ross Karchner in 2024 + ### Godot Game Template Author: [Marek Belski and contributors](https://github.com/Maaack/Godot-Game-Template/graphs/contributors) Source: [github: Godot-Game-Template](https://github.com/Maaack/Godot-Game-Template) License: [MIT License](LICENSE.txt) +### "Quit" Font +Author: [somepx](https://somepx.itch.io/) +License: Purchased and use according to license. + ## Tools #### Godot Author: [Juan Linietsky, Ariel Manzur, and contributors](https://godotengine.org/contact) Source: [godotengine.org](https://godotengine.org/) License: [MIT License](https://github.com/godotengine/godot/blob/master/LICENSE.txt) - -#### Visual Studio Code -Author: [Microsoft](https://opensource.microsoft.com/) -Source: [github: vscode](https://github.com/microsoft/vscode) -License: [MIT License](https://github.com/microsoft/vscode/blob/main/LICENSE.txt) - -#### Git -Author: [Linus Torvalds](https://github.com/torvalds) -Source: [git-scm.com](https://git-scm.com/downloads) -License: [GNU General Public License version 2](https://opensource.org/licenses/GPL-2.0) diff --git a/assets/fonts/Quit 13.ttf b/assets/fonts/Quit 13.ttf new file mode 100644 index 0000000..bdd2749 Binary files /dev/null and b/assets/fonts/Quit 13.ttf differ diff --git a/assets/fonts/Quit 13.ttf.import b/assets/fonts/Quit 13.ttf.import new file mode 100644 index 0000000..50a2243 --- /dev/null +++ b/assets/fonts/Quit 13.ttf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bgo6tp8of0gef" +path="res://.godot/imported/Quit 13.ttf-06997ae2f9cd9b4a4543265623a416ca.fontdata" + +[deps] + +source_file="res://assets/fonts/Quit 13.ttf" +dest_files=["res://.godot/imported/Quit 13.ttf-06997ae2f9cd9b4a4543265623a416ca.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/project.godot b/project.godot index 40146e9..c12bc6b 100644 --- a/project.godot +++ b/project.godot @@ -77,6 +77,16 @@ click={ "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(82, 23),"global_position":Vector2(94, 80),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) ] } +skip_level={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"location":0,"echo":false,"script":null) +] +} +cheat={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":67,"location":0,"echo":false,"script":null) +] +} [internationalization] diff --git a/scenes/Credits/Credits.tscn b/scenes/Credits/Credits.tscn index f50d027..8a62d4b 100644 --- a/scenes/Credits/Credits.tscn +++ b/scenes/Credits/Credits.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=3 uid="uid://diut1db2bsqla"] -[ext_resource type="PackedScene" path="res://addons/maaacks_game_template/base/scenes/Credits/Credits.tscn" id="1_s3dg4"] +[ext_resource type="PackedScene" uid="uid://t2dui8ppm3a4" path="res://addons/maaacks_game_template/base/scenes/Credits/Credits.tscn" id="1_s3dg4"] [ext_resource type="Script" path="res://scenes/Credits/Credits.gd" id="2_lkit1"] [node name="Credits" instance=ExtResource("1_s3dg4")] diff --git a/scenes/GameScene/game.gd b/scenes/GameScene/game.gd index 62a1fd5..89ed99c 100644 --- a/scenes/GameScene/game.gd +++ b/scenes/GameScene/game.gd @@ -7,12 +7,25 @@ var current_level_instance = null @onready var piece_spawner = $GamepieceSpawner @onready var level_container = $LevelContainer +@onready var level_complete_scene = preload("res://scenes/dialog/level_complete_dialog.tscn") # Called when the node enters the scene tree for the first time. func _ready() -> void: - NetworkEvents.circuit_complete.connect(advance_level) + NetworkEvents.circuit_complete.connect(level_complete) load_current_level() +func level_complete(): + var level_complete_dialog = level_complete_scene.instantiate() + var remaining_levels = 2 - current_level + level_complete_dialog.remaining_levels = remaining_levels + if remaining_levels > 0: + level_complete_dialog.clicked_next_level.connect(advance_level) + else: + level_complete_dialog.clicked_next_level.connect(func(): + get_tree().change_scene_to_file("res://scenes/Credits/Credits.tscn") + ) + $HUD.add_child(level_complete_dialog) + func advance_level(): current_level_instance.queue_free() current_level +=1 @@ -26,6 +39,23 @@ func load_current_level(): piece_spawner.reveal_next_piece() +func _input(event: InputEvent) -> void: + if event.is_action_pressed("skip_level"): + advance_level() + if event.is_action_pressed("cheat"): + level_complete() func _on_undo_button_pressed() -> void: piece_spawner.undo() + + +func _on_gamepiece_spawner_piece_count_changed(history_depth: Variant, remaining_pices: Variant) -> void: + if history_depth == 0: + %UndoButton.disabled = true + else: + %UndoButton.disabled = false + + +func _on_start_over_button_pressed() -> void: + current_level_instance.queue_free() + load_current_level() diff --git a/scenes/GameScene/game.tscn b/scenes/GameScene/game.tscn index 275fec4..e0383e5 100644 --- a/scenes/GameScene/game.tscn +++ b/scenes/GameScene/game.tscn @@ -21,10 +21,21 @@ position = Vector2(18, 123) [node name="HUD" type="CanvasLayer" parent="."] [node name="UndoButton" type="Button" parent="HUD"] +unique_name_in_owner = true offset_left = 774.0 offset_top = 60.0 offset_right = 824.0 offset_bottom = 91.0 text = "Undo" +[node name="StartOverButton" type="Button" parent="HUD"] +unique_name_in_owner = true +offset_left = 844.0 +offset_top = 60.0 +offset_right = 894.0 +offset_bottom = 91.0 +text = "Start Over" + +[connection signal="piece_count_changed" from="GamepieceSpawner" to="." method="_on_gamepiece_spawner_piece_count_changed"] [connection signal="pressed" from="HUD/UndoButton" to="." method="_on_undo_button_pressed"] +[connection signal="pressed" from="HUD/StartOverButton" to="." method="_on_start_over_button_pressed"] diff --git a/scenes/GameScene/light.gd b/scenes/GameScene/light.gd index 35b585b..fbbf381 100644 --- a/scenes/GameScene/light.gd +++ b/scenes/GameScene/light.gd @@ -2,6 +2,7 @@ extends Node2D class_name Light +var triggered = false @onready var connection_point1 = $ConnectionPoint1 @onready var connection_point2 = $ConnectionPoint2 @@ -9,6 +10,9 @@ class_name Light var is_on = false: set(status): is_on = status + if status and not triggered: + NetworkEvents.circuit_complete.emit() + triggered = true update_display() @@ -27,7 +31,7 @@ func update_display() -> void: if is_on: $OnSprite.show() $OffSprite.hide() - NetworkEvents.circuit_complete.emit() + else: $OnSprite.hide() $OffSprite.show() diff --git a/scenes/GameScene/segment.gd b/scenes/GameScene/segment.gd index 19926d5..20b9e89 100644 --- a/scenes/GameScene/segment.gd +++ b/scenes/GameScene/segment.gd @@ -11,6 +11,8 @@ var dragStartPosition: Vector2 var dragging = false var drop_target:Area2D +var wire_colors = [Color.BLACK, Color.CORAL, Color.DARK_GREEN] + var connection_point_scene=preload("res://scenes/GameScene/connection_point.tscn") var connection_points = [] @@ -60,11 +62,13 @@ func create_connection_pair(position1, position2): add_child(connector2) func _draw() -> void: + var i = 0 for pair in connection_pairs: var position1 = positions[pair[0]] var position2 = positions[pair[1]] - draw_line(position1 - Vector2i(46,46),Vector2.ZERO,Color.BLACK,2.0) - draw_line(position2 - Vector2i(46,46),Vector2.ZERO,Color.BLACK,2.0) + draw_line(position1 - Vector2i(46,46),Vector2.ZERO,wire_colors[i],3.0) + draw_line(position2 - Vector2i(46,46),Vector2.ZERO,wire_colors[i],3.0) + i+=1 # Called when the node enters the scene tree for the first time. func _ready() -> void: diff --git a/scenes/Levels/level_2.tscn b/scenes/Levels/level_2.tscn index f1992f0..b083e21 100644 --- a/scenes/Levels/level_2.tscn +++ b/scenes/Levels/level_2.tscn @@ -19,58 +19,49 @@ sources/0 = SubResource("TileSetScenesCollectionSource_ie45y") [node name="Level2" type="Node2D"] [node name="Tiles" type="TileMapLayer" parent="."] -position = Vector2(619, 3) -tile_map_data = PackedByteArray("AAD//wMAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAIAAAAAAAAAAQD+/wEAAAAAAAAAAQD+/wMAAAAAAAAAAQD//wQAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAQAAAAAAAAAAQABAAMAAAAAAAAAAQAAAAEAAAAAAAAAAQD+/wIAAAAAAAAAAQD9/wMAAAAAAAAAAQD9/wQAAAAAAAAAAQD+/wQAAAAAAAAAAQD9/wUAAAAAAAAAAQD+/wUAAAAAAAAAAQD//wUAAAAAAAAAAQD9/wEAAAAAAAAAAQD//wEAAAAAAAAAAQACAAIAAAAAAAAAAQD8/wUAAAAAAAAAAgABAAEAAAAAAAAAAwABAAAAAAAAAAAAAQA=") +position = Vector2(637, -162) +tile_map_data = PackedByteArray("AAD//wQAAAAAAAAAAQD9/wQAAAAAAAAAAQD9/wUAAAAAAAAAAQD+/wUAAAAAAAAAAQD8/wUAAAAAAAAAAgD9/wYAAAAAAAAAAQD+/wYAAAAAAAAAAQABAAQAAAAAAAAAAwAAAAQAAAAAAAAAAQAAAAUAAAAAAAAAAQAAAAMAAAAAAAAAAQD//wUAAAAAAAAAAQA=") tile_set = SubResource("TileSet_f5i1a") [node name="PossibleSolution" type="Node2D" parent="."] -visible = false -position = Vector2(581, 178) +position = Vector2(599, 13) [node name="Segment" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-316, 142) -connection_pairs = Array[Vector2i]([Vector2i(2, -2)]) +position = Vector2(-197, 155) +connection_pairs = Array[Vector2i]([Vector2i(4, 3)]) [node name="Segment2" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-260, 28) -connection_pairs = Array[Vector2i]([Vector2i(5, 2)]) - -[node name="Segment11" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-188, 159) -connection_pairs = Array[Vector2i]([Vector2i(5, 2)]) +position = Vector2(38, 225) +connection_pairs = Array[Vector2i]([Vector2i(5, 2), Vector2i(0, 1)]) [node name="Segment12" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-88, 334) -connection_pairs = Array[Vector2i]([Vector2i(5, 2)]) +position = Vector2(-57, 226) +connection_pairs = Array[Vector2i]([Vector2i(5, 1), Vector2i(4, 2)]) [node name="Segment3" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(192, 11) -connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) +position = Vector2(132, 226) +connection_pairs = Array[Vector2i]([Vector2i(5, 1)]) [node name="Segment4" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-247, 297) +position = Vector2(-195, 295) connection_pairs = Array[Vector2i]([Vector2i(0, 1)]) [node name="Segment10" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(291, 206) +position = Vector2(-102, 293) connection_pairs = Array[Vector2i]([Vector2i(0, 1)]) [node name="Segment5" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(55, -24) -connection_pairs = Array[Vector2i]([Vector2i(4, 2)]) +position = Vector2(85, 153) +connection_pairs = Array[Vector2i]([Vector2i(4, 1)]) [node name="Segment8" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(340, 106) +position = Vector2(133, 84) connection_pairs = Array[Vector2i]([Vector2i(4, 3)]) [node name="Segment9" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(298, 334) +position = Vector2(-8, 154) connection_pairs = Array[Vector2i]([Vector2i(4, 3)]) -[node name="Segment6" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-91, -27) -connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) - [node name="Segment7" parent="PossibleSolution" instance=ExtResource("4_qc4sm")] -position = Vector2(-370, 253) -connection_pairs = Array[Vector2i]([Vector2i(1, 0)]) +position = Vector2(-150, 224) +connection_pairs = Array[Vector2i]([Vector2i(3, 0), Vector2i(2, 4)]) diff --git a/scenes/Levels/level_3.tscn b/scenes/Levels/level_3.tscn index bc279b1..502a86d 100644 --- a/scenes/Levels/level_3.tscn +++ b/scenes/Levels/level_3.tscn @@ -20,57 +20,88 @@ sources/0 = SubResource("TileSetScenesCollectionSource_ie45y") [node name="Tiles" type="TileMapLayer" parent="."] position = Vector2(619, 3) -tile_map_data = PackedByteArray("AAD//wMAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAIAAAAAAAAAAQD//wIAAAAAAAAAAQD//wEAAAAAAAAAAQD+/wEAAAAAAAAAAQD+/wIAAAAAAAAAAgABAAIAAAAAAAAAAwD+/wMAAAAAAAAAAQD//wQAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAQAAAAAAAAAAQABAAMAAAAAAAAAAQAAAAEAAAAAAAAAAQA=") +tile_map_data = PackedByteArray("AAD6/wMAAAAAAAAAAgD7/wIAAAAAAAAAAQD8/wIAAAAAAAAAAQD8/wMAAAAAAAAAAQD8/wQAAAAAAAAAAQD7/wQAAAAAAAAAAQD+/wIAAAAAAAAAAQD9/wMAAAAAAAAAAQD+/wQAAAAAAAAAAQD//wQAAAAAAAAAAQD//wMAAAAAAAAAAQD//wIAAAAAAAAAAQAAAAMAAAAAAAAAAQABAAIAAAAAAAAAAQAAAAEAAAAAAAAAAQACAAMAAAAAAAAAAQACAAEAAAAAAAAAAQD//wEAAAAAAAAAAQADAAIAAAAAAAAAAwD9/wQAAAAAAAAAAQABAAEAAAAAAAAAAQACAAIAAAAAAAAAAQA=") tile_set = SubResource("TileSet_f5i1a") [node name="PossibleSolution" type="Node2D" parent="."] -visible = false position = Vector2(581, 178) [node name="Segment" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-316, 142) +position = Vector2(-383, 14) connection_pairs = Array[Vector2i]([Vector2i(2, -2)]) [node name="Segment2" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-260, 28) -connection_pairs = Array[Vector2i]([Vector2i(5, 2)]) +position = Vector2(-152, 90) +connection_pairs = Array[Vector2i]([Vector2i(5, 1)]) [node name="Segment11" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-188, 159) +position = Vector2(-99, 155) connection_pairs = Array[Vector2i]([Vector2i(5, 2)]) [node name="Segment12" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-88, 334) -connection_pairs = Array[Vector2i]([Vector2i(5, 2)]) +position = Vector2(-11, 11) +connection_pairs = Array[Vector2i]([Vector2i(5, 1)]) [node name="Segment3" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(192, 11) +position = Vector2(-294, 15) connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) [node name="Segment4" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-247, 297) -connection_pairs = Array[Vector2i]([Vector2i(0, 1)]) +position = Vector2(-291, 160) +connection_pairs = Array[Vector2i]([Vector2i(1, 5)]) [node name="Segment10" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(291, 206) -connection_pairs = Array[Vector2i]([Vector2i(0, 1)]) +position = Vector2(-198, 155) +connection_pairs = Array[Vector2i]([Vector2i(0, 2)]) [node name="Segment5" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(55, -24) -connection_pairs = Array[Vector2i]([Vector2i(4, 2)]) +position = Vector2(-243, 85) +connection_pairs = Array[Vector2i]([Vector2i(0, 3), Vector2i(4, 2)]) [node name="Segment8" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(340, 106) -connection_pairs = Array[Vector2i]([Vector2i(4, 3)]) +position = Vector2(132, 79) +connection_pairs = Array[Vector2i]([Vector2i(5, 1)]) + +[node name="Segment13" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(129, -59) +connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) + +[node name="Segment17" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(224, -54) +connection_pairs = Array[Vector2i]([Vector2i(4, 2)]) + +[node name="Segment18" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(324, -58) +connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) + +[node name="Segment19" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(274, 16) +connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) + +[node name="Segment20" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(319, 84) +connection_pairs = Array[Vector2i]([Vector2i(0, 1)]) + +[node name="Segment14" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(42, -64) +connection_pairs = Array[Vector2i]([Vector2i(4, 2)]) + +[node name="Segment15" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(174, 15) +connection_pairs = Array[Vector2i]([Vector2i(4, 2), Vector2i(0, 1)]) + +[node name="Segment16" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] +position = Vector2(37, 87) +connection_pairs = Array[Vector2i]([Vector2i(4, 2)]) [node name="Segment9" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(298, 334) -connection_pairs = Array[Vector2i]([Vector2i(4, 3)]) +position = Vector2(-101, 12) +connection_pairs = Array[Vector2i]([Vector2i(4, 2)]) [node name="Segment6" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-91, -27) -connection_pairs = Array[Vector2i]([Vector2i(5, 3)]) +position = Vector2(-11, 148) +connection_pairs = Array[Vector2i]([Vector2i(5, 1)]) [node name="Segment7" parent="PossibleSolution" instance=ExtResource("4_rvlkf")] -position = Vector2(-370, 253) -connection_pairs = Array[Vector2i]([Vector2i(1, 0)]) +position = Vector2(-382, 158) +connection_pairs = Array[Vector2i]([Vector2i(2, 0)]) diff --git a/scenes/Menus/MainMenu/MainMenuWithAnimations.tscn b/scenes/Menus/MainMenu/MainMenuWithAnimations.tscn index b3c49e9..6ae37c7 100644 --- a/scenes/Menus/MainMenu/MainMenuWithAnimations.tscn +++ b/scenes/Menus/MainMenu/MainMenuWithAnimations.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=16 format=3 uid="uid://dpel22uvxis52"] -[ext_resource type="PackedScene" path="res://scenes/Menus/MainMenu/MainMenu.tscn" id="1_dufvr"] +[ext_resource type="PackedScene" uid="uid://2pm27icc6qj5" path="res://scenes/Menus/MainMenu/MainMenu.tscn" id="1_dufvr"] [ext_resource type="Script" path="res://scenes/Menus/MainMenu/MainMenuWithAnimations.gd" id="2_2xj2y"] [sub_resource type="Animation" id="1"] diff --git a/scenes/dialog/level_complete_dialog.gd b/scenes/dialog/level_complete_dialog.gd new file mode 100644 index 0000000..edf7a40 --- /dev/null +++ b/scenes/dialog/level_complete_dialog.gd @@ -0,0 +1,19 @@ +extends Control +signal clicked_next_level + +var remaining_levels = 0 + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + if remaining_levels == 0: + %Message.text = "You've completed all of the levels" + %Title.text = "[rainbow freq=1.0 sat=0.8 val=0.8][wave amp=50.0 freq=5.0 connected=1][center]Whoa![/center][/wave]" + %Button.text = "Who made this crazy thing?" + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + +func _on_button_pressed() -> void: + clicked_next_level.emit() + queue_free() diff --git a/scenes/dialog/level_complete_dialog.tscn b/scenes/dialog/level_complete_dialog.tscn new file mode 100644 index 0000000..73552d1 --- /dev/null +++ b/scenes/dialog/level_complete_dialog.tscn @@ -0,0 +1,69 @@ +[gd_scene load_steps=3 format=3 uid="uid://ce0fxyeo78jdg"] + +[ext_resource type="Script" path="res://scenes/dialog/level_complete_dialog.gd" id="1_kdra6"] +[ext_resource type="FontFile" uid="uid://bgo6tp8of0gef" path="res://assets/fonts/Quit 13.ttf" id="1_n80a8"] + +[node name="LevelCompleteDialog" type="Control"] +layout_mode = 3 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -114.0 +offset_top = -166.0 +offset_right = -114.0 +offset_bottom = -166.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_kdra6") + +[node name="Panel" type="Panel" parent="."] +custom_minimum_size = Vector2(300, 200) +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="MarginContainer" type="MarginContainer" parent="Panel"] +custom_minimum_size = Vector2(0, 15) +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 37.0 +grow_horizontal = 2 +theme_override_constants/margin_top = 19 + +[node name="HBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"] +layout_mode = 2 + +[node name="Title" type="RichTextLabel" parent="Panel/MarginContainer/HBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +size_flags_stretch_ratio = 0.0 +theme_override_fonts/normal_font = ExtResource("1_n80a8") +bbcode_enabled = true +text = "[rainbow freq=1.0 sat=0.8 val=0.8][wave amp=50.0 freq=5.0 connected=1][center]Well Done![/center][/wave]" + +[node name="Placeholder" type="Label" parent="Panel/MarginContainer/HBoxContainer"] +layout_mode = 2 + +[node name="Message" type="Label" parent="Panel/MarginContainer/HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "You've completed this circuit!" +horizontal_alignment = 1 + +[node name="Placeholder2" type="Label" parent="Panel/MarginContainer/HBoxContainer"] +layout_mode = 2 + +[node name="Button" type="Button" parent="Panel/MarginContainer/HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 3 +text = "On to the next challenge..." + +[connection signal="pressed" from="Panel/MarginContainer/HBoxContainer/Button" to="." method="_on_button_pressed"] diff --git a/scenes/gamepiece_spawner.gd b/scenes/gamepiece_spawner.gd index 829a8ad..c915bc8 100644 --- a/scenes/gamepiece_spawner.gd +++ b/scenes/gamepiece_spawner.gd @@ -1,6 +1,7 @@ extends Node2D class_name GamepieceSpawner +signal piece_count_changed(history_depth, remaining_pices) var queue:Node2D @@ -8,6 +9,9 @@ var next_piece:Segment = null var history =[] +func notify_piece_counts(): + piece_count_changed.emit(history.size(), queue.get_child_count()) + func _ready() -> void: prepare() @@ -20,6 +24,7 @@ func prepare(): queue = Node2D.new() queue.hide() add_child(queue) + notify_piece_counts() func add_segments_to_queue(pieces:Array[Node]) -> void: pieces.shuffle() @@ -28,9 +33,11 @@ func add_segments_to_queue(pieces:Array[Node]) -> void: piece.dropped.connect(record_history) piece.dropped.connect(reveal_next_piece) piece.reparent(queue) + notify_piece_counts() func record_history(last_played_segment): history.append(last_played_segment) + notify_piece_counts() func undo(): if next_piece: @@ -40,6 +47,7 @@ func undo(): last_piece.global_position = global_position last_piece.restore_playable() next_piece = last_piece + notify_piece_counts() func reveal_next_piece(_last_played_segment=null) -> void: if queue.get_child_count()<1: @@ -48,3 +56,4 @@ func reveal_next_piece(_last_played_segment=null) -> void: if next_piece: next_piece.global_position = global_position next_piece.reparent(self) + notify_piece_counts() diff --git a/scenes/power_source.gd b/scenes/power_source.gd new file mode 100644 index 0000000..21a3968 --- /dev/null +++ b/scenes/power_source.gd @@ -0,0 +1,23 @@ +extends Node2D + + +const positions = [ + Vector2i(21,12), + Vector2i(70,12), + Vector2i(92,46 ), + Vector2i(70,80), + Vector2i(21,79), + Vector2i(0,46 ), +] + +@export var positive_location = 0 +@export var negative_location =3 + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/scenes/power_source.tscn b/scenes/power_source.tscn index 53b2086..b314704 100644 --- a/scenes/power_source.tscn +++ b/scenes/power_source.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=3 format=3 uid="uid://73fcyu51g72"] +[gd_scene load_steps=4 format=3 uid="uid://73fcyu51g72"] +[ext_resource type="Script" path="res://scenes/power_source.gd" id="1_camaq"] [ext_resource type="Texture2D" uid="uid://tmvp21h2he05" path="res://assets/images/hex-powersource.png" id="1_idmp2"] [ext_resource type="PackedScene" uid="uid://7ycpev6cp8qd" path="res://scenes/GameScene/connection_point.tscn" id="2_ekvq5"] [node name="PowerSource" type="Node2D"] +script = ExtResource("1_camaq") [node name="Sprite2D" type="Sprite2D" parent="."] texture = ExtResource("1_idmp2")