Added killing area

This commit is contained in:
2026-01-26 23:12:04 +03:00
parent cd74b87ca2
commit 0092c72a64
3 changed files with 26 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
class_name KillingArea
extends Area2D
func _on_body_entered(body: Node2D) -> void:
if not body is CharacterBody2D: return
if body.has_method("kill"):
body.kill()
else:
body.queue_free()
+1
View File
@@ -0,0 +1 @@
uid://ju1xwik0kpjy
+14
View File
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://dike8xgbqdut2"]
[ext_resource type="Script" uid="uid://ju1xwik0kpjy" path="res://game/killing_area.gd" id="1_ycsf0"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ycsf0"]
size = Vector2(16, 16)
[node name="KillingArea" type="Area2D"]
script = ExtResource("1_ycsf0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_ycsf0")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]