Hello,
Is there a way to code only 1 object when entering an Area ?
Iam using this code in a 3D area.tcsn
func _on_hitBox_area_entered(area: Area) -> void:
victim = area.get_owner();
$snd_hit_Effect.play();
_flash_create();
print(get_overlapping_areas());
#---set--victim----
victim.state = attacker.hit_st;
victim.anim.play(attacker.hit_anim);
victim.pauseTimer = hitPauseTime;
victim.health -= 10;
#---set--attacker----
attacker.comboDelay = 1.0;
attacker.pauseTimer = hitPauseTime;
The function " _on_hitBox_area_entered " returns an array of all the objects that entered the Area.
" hitBoxName.get_overlapping_areas() "
I wanted to be able to switch between detecting only 1 body or multiple objects... this way the areaBox would only hit 1 enemy instead of hiting multiple enemies within the areaBox range.
Is there a way to do it ?
print(get_overlapping_areas());
! --- Debugging process started ---
! Godot Engine v3.4.stable.mono.official.206ba70f4 - https://godotengine.org
! OpenGL ES 3.0 Renderer: AMD Radeon R9 200 Series
! OpenGL ES Batching: ON
!
!
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1585]]
! [hurtBox:[Area:1585]]
! [hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! [hurtBox:[Area:1574]]
! [hurtBox:[Area:1574], hurtBox:[Area:1585]]
! --- Debugging process stopped ---