You’re setting the collision layer twice instead of the mask. Also, I think it would be helpful to use names for the physics layers instead of numbers. (64 means the 7th physics layer)
this is not a good way to do it. I’m not sure, but I think area will be Area2D, never a_hitbox (also, class_names should be in PascalCase as per the gdscript style)
Instead, cast area and check if it’s null:
var a_hb : a_hitbox = area as a_hitbox
if a_hb:
get_parent().take_damage()
collision_layer is not the same as collision_mask. collision_layer is the layer the object belongs to, collision_mask is the objects it can collide with.
also, no need to assign it twice.
Just tested it, the custom area2d-derived class will count as both an Area2D and the custom class as well (even if you type hint the method to area: Area2D). So I do not think that’s the issue.
i think the func _on_area_entered(area) → void: (area) was the issue and after i just deleted its just () now _on_area_entered() ) it actually does something and gives error in debugger :
"emit_signalp: Error calling from signal ‘area_entered’ to callabke ‘Area2d(hurtbox.gd)::_on_area_entered’: Method expected 0 arugemnt(s), but called with 1.
The area_entered signal always passes the area that entered as argument. Because of that, the signal needs to be connected to a function that can receive this argument. The error happens because you removed the (area) parameter, so you need to put that back in.
That said, according to the error, the signal was emitted and did attempt to call the function. Did you test this version before removing (area)? Was it printing “A”?