Restored enemy bullets collision

This commit is contained in:
Marco 2025-01-31 16:06:15 +01:00
commit 4e09694692
5 changed files with 34 additions and 2 deletions

View file

@ -3,7 +3,7 @@ using Godot;
using System;
using System.Diagnostics;
public partial class Enemy : CharacterBody2D, IDestructible
public partial class Enemy : CharacterBody2D
{
private InteractionController _cachedPlayer;
private EnemyState _currentState = EnemyState.Idle;
@ -190,6 +190,14 @@ public partial class Enemy : CharacterBody2D, IDestructible
_currentState = EnemyState.Idle;
}
}
private void _on_damage_hitbox_area_entered(Area2D area)
{
if (area is not Bullet bullet) return;
GD.Print("Enemy Received damage");
this.Hit(bullet.Damage);
bullet.QueueFree();
}
// Bullets collision
private void _on_area_entered(Area2D area)