Basic Bat enemy AI

This commit is contained in:
Alan Youngblood
2024-11-19 17:04:41 -05:00
parent 656c3278a4
commit 23a693d4a9
9 changed files with 135 additions and 6 deletions

View File

@ -0,0 +1,22 @@
extends Area2D
export(bool) var show_hit = true
const HitEffect = preload("res://Effects/HitEffect.tscn")
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Hurtbox_area_entered(area):
if show_hit:
var effect = HitEffect.instance()
var main = get_tree().current_scene
main.add_child(effect)
effect.global_position = global_position

View File

@ -1,7 +1,12 @@
[gd_scene format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Overlap/Hurtbox.gd" type="Script" id=1]
[node name="Hurtbox" type="Area2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
[connection signal="area_entered" from="." to="." method="_on_Hurtbox_area_entered"]