Improves lightning projectile behavior

Refactors the lightning projectile to handle collisions more effectively. It now stops upon hitting an enemy or object, triggers an explosion, and spawns child projectiles from the collision point.  The lightning bolt's collision shape is dynamically updated to match the remaining distance to the target or the collision point. Also adds more test enemies to the map for testing purposes.
This commit is contained in:
Dan Baker 2025-05-06 09:30:44 +01:00
parent d0c2a7b3c8
commit 1a959fbc0c
7 changed files with 232 additions and 41 deletions

View file

@ -4,22 +4,23 @@
[ext_resource type="PackedScene" uid="uid://cafaf3en63bp6" path="res://assets/projectiles/components/bolt.tscn" id="2_gc60m"]
[node name="ProjectileLightning" type="Area2D"]
collision_layer = 16
collision_mask = 12
script = ExtResource("1_2ex40")
[node name="Bolt" parent="." instance=ExtResource("2_gc60m")]
modulate = Color(0.161899, 0.42984, 0.777414, 1)
rotation = 0.872665
[node name="Bolt2" parent="." instance=ExtResource("2_gc60m")]
modulate = Color(0.443066, 0.672326, 1, 1)
rotation = 0.872665
[node name="Bolt3" parent="." instance=ExtResource("2_gc60m")]
modulate = Color(0.205858, 0.510414, 0.999999, 1)
rotation = 0.349066
[node name="Bolt4" parent="." instance=ExtResource("2_gc60m")]
modulate = Color(1, 1, 1, 0.596078)
[node name="Bolt5" parent="." instance=ExtResource("2_gc60m")]
modulate = Color(1, 1, 1, 0.603922)
[node name="Bolt6" parent="." instance=ExtResource("2_gc60m")]