Question
So I am making a 2d shooter game where you can Use the gun to Make platform’s and also shoot bullet’s to kill enemy’s i am a beginner though and I have gotten stuck making the combat system in can make the enemy’s die when shot but if there is two enemy’s and player kills one and then gets killed by the other one when respawned player can’t kill the enemy’s anymore
bullet code :
extends Area2D
# varibels
const SPEED: int =1000
#moves the bullet
func _process(delta: float) -> void:
position += transform.x * SPEED *delta
#destroy when not visible
func _on_visible_on_screen_enabler_2d_screen_exited() -> void:
queue_free()
enemy code:
extends CharacterBody2D
var health = 10
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.name == "bullet":
queue_free()
what should i do?