Spatial 2D sound w/ reverb, first attempt

This commit is contained in:
ChaoticByte 2024-10-05 09:50:03 +02:00
parent 7833a1c756
commit 3ec5a9edf7
No known key found for this signature in database
17 changed files with 192 additions and 13 deletions

25
core/polygon/polygon.gd Normal file
View file

@ -0,0 +1,25 @@
@tool
extends CollisionPolygon2D
@export var color: Color = Color.WHITE:
set(v):
color = v
update_polygon()
get():
return color
@export var update: bool:
set(v):
update_polygon()
func update_polygon():
# normal polygon
$Polygon2D.polygon = polygon
$Polygon2D.color = color
# light occluder
var lo_polygon = OccluderPolygon2D.new()
lo_polygon.polygon = polygon
$LightOccluder2D.occluder = lo_polygon
func _ready() -> void:
update_polygon()

14
core/polygon/polygon.tscn Normal file
View file

@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://cbynoofsjcl45"]
[ext_resource type="Script" path="res://core/polygon/polygon.gd" id="1_ga37f"]
[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_lp5j7"]
[node name="Polygon" type="CollisionPolygon2D"]
script = ExtResource("1_ga37f")
[node name="Polygon2D" type="Polygon2D" parent="."]
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
editor_description = "For particle collisions"
occluder = SubResource("OccluderPolygon2D_lp5j7")