From 5496914c2ab9f584fd6aeebdb307e91c460a943f Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Sat, 19 Aug 2023 15:56:45 +0300 Subject: [PATCH] FUCKFUCKFUCK --- scenes/level.tscn | 5 ++++- scenes/main_scene.tscn | 6 ++++-- scripts/Level.cs | 12 ++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 scripts/Level.cs diff --git a/scenes/level.tscn b/scenes/level.tscn index 640dd98..dc4f303 100644 --- a/scenes/level.tscn +++ b/scenes/level.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=22 format=3 uid="uid://cn0rwyjern2vx"] +[gd_scene load_steps=23 format=3 uid="uid://cn0rwyjern2vx"] +[ext_resource type="Script" path="res://scripts/Level.cs" id="1_cxv3e"] [ext_resource type="TileSet" uid="uid://c7x8hryljgpha" path="res://sprites/tiles/QoL.tres" id="1_kp7y7"] [ext_resource type="PackedScene" uid="uid://b2nngdg27wccf" path="res://prefabs/furniture/bed.tscn" id="2_7ee73"] [ext_resource type="PackedScene" uid="uid://chd3lj3gisjgj" path="res://prefabs/furniture/window.tscn" id="3_1vbfb"] @@ -24,6 +25,7 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_kwmx6"] [node name="level" type="Node2D"] +script = ExtResource("1_cxv3e") [node name="TileMap" type="TileMap" parent="."] tile_set = ExtResource("1_kp7y7") @@ -446,6 +448,7 @@ CountOfButtons = 4 [connection signal="ButtonUnpressed" from="pressure_plate_puzzle_4_tr" to="And_puzzle_4" method="Decrement"] [connection signal="body_entered" from="BossArea2D" to="claw" method="Enable" flags=6] [connection signal="body_entered" from="BossArea2D" to="claw2" method="Enable" flags=6] +[connection signal="Killed" from="boss" to="." method="BossDied" flags=6] [connection signal="ConditionMet" from="And_puzzle_3" to="door_closed_puzzle_3" method="Open"] [connection signal="ConditionNotMet" from="And_puzzle_3" to="door_closed_puzzle_3" method="Close"] [connection signal="ConditionMet" from="And_puzzle_4" to="door_closed_puzzle_4" method="Open"] diff --git a/scenes/main_scene.tscn b/scenes/main_scene.tscn index da1a059..0eb26f9 100644 --- a/scenes/main_scene.tscn +++ b/scenes/main_scene.tscn @@ -22,7 +22,7 @@ point_count = 2 [sub_resource type="ShaderMaterial" id="ShaderMaterial_m680d"] shader = ExtResource("5_64d71") -[sub_resource type="ViewportTexture" id="ViewportTexture_x6taj"] +[sub_resource type="ViewportTexture" id="ViewportTexture_42ps6"] viewport_path = NodePath("FlashlightViewport") [sub_resource type="CircleShape2D" id="CircleShape2D_prnh4"] @@ -242,7 +242,7 @@ CameraBounds = Vector2(30, 20) [node name="PointLight2D" type="PointLight2D" parent="PlayerCamera" node_paths=PackedStringArray("LightViewport")] blend_mode = 2 range_item_cull_mask = 2 -texture = SubResource("ViewportTexture_x6taj") +texture = SubResource("ViewportTexture_42ps6") script = ExtResource("6_slohe") LightViewport = NodePath("../../FlashlightViewport") @@ -359,4 +359,6 @@ text = "Thank you for playing! :)" horizontal_alignment = 1 vertical_alignment = 1 +[connection signal="GameOver" from="GameManager" to="CanvasLayer/WinScreen" method="Open"] +[connection signal="BossKilled" from="level" to="GameManager" method="EndGame"] [connection signal="timeout" from="CanvasLayer/DeathScreen/Timer" to="CanvasLayer/DeathScreen" method="Timeout"] diff --git a/scripts/Level.cs b/scripts/Level.cs new file mode 100644 index 0000000..21ae3ce --- /dev/null +++ b/scripts/Level.cs @@ -0,0 +1,12 @@ +using Godot; +using System; + +public partial class Level : Node2D +{ + [Signal] public delegate void BossKilledEventHandler(); + + public void BossDied() + { + EmitSignal(SignalName.BossKilled); + } +}