Added killing area
This commit is contained in:
@@ -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()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://ju1xwik0kpjy
|
||||||
@@ -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"]
|
||||||
Reference in New Issue
Block a user