You can call base class functions by writing a
. in front of the call, like this:
.some_function(id, item_name, type)
However, something very odd but important that Godot is doing, is that it calls
_init automatically and in some special way (this also happens with special functions like
_input). So if you were to write this:
class B extends A:
It will print:
Notice how we didnt call the base class's
_init(). So basically, you don't have to call the base function.
Instead, you do this:
func _init(a, b, c).(a, b):
Notice the extra
.(a, b), this is how you call the base constructor with custom arguments.
var for each argument, but you don't have to, they are optional.
_init to be called, I assume you are creating those objects from script, using
Health.new() for example. On the other hand, I see you extend Node, but do you need this to be in the scene tree? (it won't be if you don't add them as child of another node).
If you don't, you can simply remove
extends Node and
_ready(), as you don't seem to use them here.