im making a healing item and when the player collects it he does not get his health back
heres everything in the script that refrences everything
var healthRejen = false
func _on_gabes_hitbox_body_entered(body: Node2D) → void:
if body.has_method(“REJEMT”):
healthRejen = true
func healthrejen():
if healthRejen == true:
health = health + 10
print(health)
heres the script for the health rejen
extends Node2D
Make sure to explain what you expect to happen versus what really happens in detail.
Your “health rejen” may not have a collision Body, only a collision Area, that’s why I could see the signal body_entered not triggering. Better yet I’m sure you could keep the health addition entirely on the health node, but you need to filter the player by other means than has_method
func _on_area_2d_body_entered(body: Node2D) -> void:
if "health" in body: # check for property health
body.health += 10 # add 10 health to the colliding body
queue_free()