Basic Bat enemy AI
This commit is contained in:
22
ActionRPG-HeartBeast/Overlap/Hurtbox.gd
Normal file
22
ActionRPG-HeartBeast/Overlap/Hurtbox.gd
Normal 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
|
@ -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"]
|
||||
|
Reference in New Issue
Block a user