resonance
This commit is contained in:
13
common/globals/resonance.gd
Normal file
13
common/globals/resonance.gd
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
signal fragment_collected
|
||||||
|
|
||||||
|
var _resonance_fragments: int = 0
|
||||||
|
|
||||||
|
func collect_fragments(count: int):
|
||||||
|
if count > 0:
|
||||||
|
_resonance_fragments += count
|
||||||
|
fragment_collected.emit()
|
||||||
|
|
||||||
|
func get_fragment_count():
|
||||||
|
return _resonance_fragments
|
||||||
1
common/globals/resonance.gd.uid
Normal file
1
common/globals/resonance.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dfn4l008e5cm0
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
extends Interactable
|
extends Interactable
|
||||||
class_name Receiver
|
class_name Receiver
|
||||||
|
|
||||||
|
@export var stored_energy: float = 0
|
||||||
|
|
||||||
func _on_interaction_area_body_entered(body: Player) -> void:
|
func _on_interaction_area_body_entered(body: Player) -> void:
|
||||||
body.interaction_target = self
|
body.interaction_target = self
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ extends EnergyAcceptor
|
|||||||
|
|
||||||
func energize(energy: float, position: Vector2):
|
func energize(energy: float, position: Vector2):
|
||||||
receiver.modulate = Color.GREEN
|
receiver.modulate = Color.GREEN
|
||||||
|
receiver.stored_energy += energy
|
||||||
|
|
||||||
func deplete():
|
func deplete():
|
||||||
receiver.modulate = Color.WHITE
|
receiver.modulate = Color.WHITE
|
||||||
|
|||||||
BIN
entities/resonance/fragment/resonance_fragment.aseprite
Normal file
BIN
entities/resonance/fragment/resonance_fragment.aseprite
Normal file
Binary file not shown.
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://8o4m2hhug7m2"
|
||||||
|
path="res://.godot/imported/resonance_fragment.aseprite-eb1e5f8855d0edd5fd209db6a390b133.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://entities/resonance/fragment/resonance_fragment.aseprite"
|
||||||
|
dest_files=["res://.godot/imported/resonance_fragment.aseprite-eb1e5f8855d0edd5fd209db6a390b133.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
6
entities/resonance/fragment/resonance_fragment.gd
Normal file
6
entities/resonance/fragment/resonance_fragment.gd
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
extends Interactable
|
||||||
|
|
||||||
|
func interact(player: Player):
|
||||||
|
Resonance.collect_fragments(1)
|
||||||
|
print("Fragment collected")
|
||||||
|
queue_free()
|
||||||
1
entities/resonance/fragment/resonance_fragment.gd.uid
Normal file
1
entities/resonance/fragment/resonance_fragment.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://j36u8fr5qfnv
|
||||||
23
entities/resonance/fragment/resonance_fragment.tscn
Normal file
23
entities/resonance/fragment/resonance_fragment.tscn
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://hgudcjglmgu3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://j36u8fr5qfnv" path="res://entities/resonance/fragment/resonance_fragment.gd" id="1_ths52"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://8o4m2hhug7m2" path="res://entities/resonance/fragment/resonance_fragment.aseprite" id="2_1bsyt"]
|
||||||
|
[ext_resource type="Script" uid="uid://dryjau28sybgd" path="res://common/interactable_body.gd" id="3_rlkgh"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_h3krt"]
|
||||||
|
radius = 7.0
|
||||||
|
|
||||||
|
[node name="ResonanceFragment" type="Node2D"]
|
||||||
|
script = ExtResource("1_ths52")
|
||||||
|
metadata/_custom_type_script = "uid://csbip0oj1uu0j"
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.5, 0.5)
|
||||||
|
texture = ExtResource("2_1bsyt")
|
||||||
|
|
||||||
|
[node name="InteractableBody" type="StaticBody2D" parent="."]
|
||||||
|
script = ExtResource("3_rlkgh")
|
||||||
|
metadata/_custom_type_script = "uid://dryjau28sybgd"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractableBody"]
|
||||||
|
shape = SubResource("CircleShape2D_h3krt")
|
||||||
@@ -15,6 +15,10 @@ run/main_scene="uid://bopet83k23n7t"
|
|||||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
Resonance="*res://common/globals/resonance.gd"
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
|
|
||||||
version_control/plugin_name="GitPlugin"
|
version_control/plugin_name="GitPlugin"
|
||||||
|
|||||||
7
ui/world/resource_container.gd
Normal file
7
ui/world/resource_container.gd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
extends HBoxContainer
|
||||||
|
class_name ResourceContainer
|
||||||
|
|
||||||
|
@onready var resource_count: Label = %ResourceCount
|
||||||
|
|
||||||
|
func update_resource_count(count: int):
|
||||||
|
resource_count.text = String.num(count, 0)
|
||||||
1
ui/world/resource_container.gd.uid
Normal file
1
ui/world/resource_container.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dni6uvp0jginl
|
||||||
20
ui/world/resource_container.tscn
Normal file
20
ui/world/resource_container.tscn
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://bvxyjrqyxfho8"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dni6uvp0jginl" path="res://ui/world/resource_container.gd" id="1_2qhpl"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://8o4m2hhug7m2" path="res://entities/resonance/fragment/resonance_fragment.aseprite" id="1_q10xt"]
|
||||||
|
|
||||||
|
[node name="ResourceContainer" type="HBoxContainer"]
|
||||||
|
script = ExtResource("1_2qhpl")
|
||||||
|
|
||||||
|
[node name="ResourceTexture" type="TextureRect" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("1_q10xt")
|
||||||
|
|
||||||
|
[node name="ResourceLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Resonance Fragments:"
|
||||||
|
|
||||||
|
[node name="ResourceCount" type="Label" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "0"
|
||||||
9
ui/world/world_gui.gd
Normal file
9
ui/world/world_gui.gd
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
@onready var resonance_container: ResourceContainer = %ResonanceContainer
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
Resonance.fragment_collected.connect(_update_resonance_fragments)
|
||||||
|
|
||||||
|
func _update_resonance_fragments():
|
||||||
|
resonance_container.update_resource_count(Resonance.get_fragment_count())
|
||||||
1
ui/world/world_gui.gd.uid
Normal file
1
ui/world/world_gui.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://4j3yn7ianpwa
|
||||||
36
ui/world/world_gui.tscn
Normal file
36
ui/world/world_gui.tscn
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://brxffqulpxvfg"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://4j3yn7ianpwa" path="res://ui/world/world_gui.gd" id="1_7mgj1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bvxyjrqyxfho8" path="res://ui/world/resource_container.tscn" id="2_wcbix"]
|
||||||
|
|
||||||
|
[node name="WorldGui" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_7mgj1")
|
||||||
|
|
||||||
|
[node name="TopRightContainer" type="PanelContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 1
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_left = -225.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TopRightContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 8
|
||||||
|
theme_override_constants/margin_top = 4
|
||||||
|
theme_override_constants/margin_right = 8
|
||||||
|
theme_override_constants/margin_bottom = 4
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="TopRightContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ResonanceContainer" parent="TopRightContainer/MarginContainer/VBoxContainer" instance=ExtResource("2_wcbix")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
[gd_scene load_steps=12 format=4 uid="uid://bopet83k23n7t"]
|
[gd_scene load_steps=14 format=4 uid="uid://bopet83k23n7t"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://134x6njync81" path="res://entities/terrain/grass/grass.aseprite" id="1_vd0v3"]
|
[ext_resource type="Texture2D" uid="uid://134x6njync81" path="res://entities/terrain/grass/grass.aseprite" id="1_vd0v3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://brxffqulpxvfg" path="res://ui/world/world_gui.tscn" id="1_yxo24"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cprggjrluc751" path="res://entities/player/player.tscn" id="2_8t5gy"]
|
[ext_resource type="PackedScene" uid="uid://cprggjrluc751" path="res://entities/player/player.tscn" id="2_8t5gy"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b16ui0wwwtfq8" path="res://entities/terrain/fog/fog.aseprite" id="2_hen7s"]
|
[ext_resource type="Texture2D" uid="uid://b16ui0wwwtfq8" path="res://entities/terrain/fog/fog.aseprite" id="2_hen7s"]
|
||||||
[ext_resource type="PackedScene" uid="uid://q3f3j7p3t43w" path="res://entities/button/button.tscn" id="3_8t5gy"]
|
[ext_resource type="PackedScene" uid="uid://q3f3j7p3t43w" path="res://entities/button/button.tscn" id="3_8t5gy"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cayxfaqxv0irg" path="res://entities/emitter/emitter.tscn" id="4_6qmhn"]
|
[ext_resource type="PackedScene" uid="uid://cayxfaqxv0irg" path="res://entities/emitter/emitter.tscn" id="4_6qmhn"]
|
||||||
[ext_resource type="PackedScene" uid="uid://docbcbiad4ghy" path="res://entities/deflector/deflector.tscn" id="5_wjxv1"]
|
[ext_resource type="PackedScene" uid="uid://docbcbiad4ghy" path="res://entities/deflector/deflector.tscn" id="5_wjxv1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://fo3xwyve7i5p" path="res://entities/receiver/receiver.tscn" id="6_vcuff"]
|
[ext_resource type="PackedScene" uid="uid://fo3xwyve7i5p" path="res://entities/receiver/receiver.tscn" id="6_vcuff"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://hgudcjglmgu3" path="res://entities/resonance/fragment/resonance_fragment.tscn" id="8_2l688"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_6qmhn"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_6qmhn"]
|
||||||
texture = ExtResource("1_vd0v3")
|
texture = ExtResource("1_vd0v3")
|
||||||
@@ -252,3 +254,10 @@ position = Vector2(246, 148)
|
|||||||
|
|
||||||
[node name="Receiver" parent="." instance=ExtResource("6_vcuff")]
|
[node name="Receiver" parent="." instance=ExtResource("6_vcuff")]
|
||||||
position = Vector2(264, 23)
|
position = Vector2(264, 23)
|
||||||
|
|
||||||
|
[node name="ResonanceFragment" parent="." instance=ExtResource("8_2l688")]
|
||||||
|
position = Vector2(221, -128)
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="WorldGui" parent="CanvasLayer" instance=ExtResource("1_yxo24")]
|
||||||
|
|||||||
Reference in New Issue
Block a user