Add LightOccluder2D to player to affect rain

This commit is contained in:
ChaoticByte 2024-10-02 21:53:10 +02:00
parent 5a67d46d6f
commit 49fce1d69d
No known key found for this signature in database
3 changed files with 15 additions and 4 deletions

View file

@ -21,6 +21,6 @@ process_material = SubResource("ParticleProcessMaterial_v306m")
lifetime = 2.5 lifetime = 2.5
preprocess = 3.0 preprocess = 3.0
fixed_fps = 0 fixed_fps = 0
visibility_rect = Rect2(-512, 0, 1024, 1024) visibility_rect = Rect2(-1024, -1024, 2048, 2048)
trail_enabled = true trail_enabled = true
trail_lifetime = 0.03 trail_lifetime = 0.03

View file

@ -1,10 +1,15 @@
[gd_scene load_steps=2 format=3 uid="uid://dqf665b540tfg"] [gd_scene load_steps=3 format=3 uid="uid://dqf665b540tfg"]
[ext_resource type="PackedScene" uid="uid://cbynoofsjcl45" path="res://core/polygon.tscn" id="1_xm2ft"] [ext_resource type="PackedScene" uid="uid://cbynoofsjcl45" path="res://core/polygon.tscn" id="1_xm2ft"]
[ext_resource type="PackedScene" uid="uid://b8cjp6hiqycxe" path="res://core/rain.tscn" id="2_31352"]
[node name="Test" type="Node2D"] [node name="Test" type="Node2D"]
[node name="StaticBody2D" type="StaticBody2D" parent="."] [node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="Polygon" parent="StaticBody2D" instance=ExtResource("1_xm2ft")] [node name="Polygon" parent="StaticBody2D" instance=ExtResource("1_xm2ft")]
polygon = PackedVector2Array(-104, 232, -104, 320, 552, 320, 552, 232) polygon = PackedVector2Array(-104, 232, -104, 320, 1024, 320, 1024, 232)
[node name="Rain" parent="." instance=ExtResource("2_31352")]
position = Vector2(1128, -400)
amount_ratio = 1.0

View file

@ -1,7 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://ebb4pfxklatj"] [gd_scene load_steps=4 format=3 uid="uid://ebb4pfxklatj"]
[ext_resource type="Script" path="res://player/player.gd" id="1_fob34"] [ext_resource type="Script" path="res://player/player.gd" id="1_fob34"]
[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_p33ik"]
polygon = PackedVector2Array(-9, -9, -9, 9, 9, 9, 9, -9)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7cq61"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_7cq61"]
size = Vector2(16, 16) size = Vector2(16, 16)
@ -15,6 +18,9 @@ position_smoothing_enabled = true
drag_horizontal_enabled = true drag_horizontal_enabled = true
drag_vertical_enabled = true drag_vertical_enabled = true
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
occluder = SubResource("OccluderPolygon2D_p33ik")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_7cq61") shape = SubResource("RectangleShape2D_7cq61")