Hi, I just started learning godot, and ran into an issue. I have three scenes which all (in their scripts) inherit from a class I made (CustomNode2D, which in itself extends from Node2D. The scenes will share many methods, with slight changes, that's why I'd rather use inheritance here.
My ItemGenerator.tscn scene is linked to the script ItemGenerator.gd , which has this at the beginning:
And I can properly use the methods lying in "CustomNode2D", so this works fine. However, I have a different scene, Product.tscn, which uses the script Product.gd, which also has those lines at the beginning:
The structure of my ItemGenerator scene is:
- ItemGeneratorSprite (AnimatedSprite)
- ItemGeneratorCollision (CollisionShape2D)
The structure of my Product scene is exactly the same, just with different names.
When I instance a Product by doing:
var item = load('res://Scenes/Product.tscn').instance()
I can use the methods in Product.gd, but not inside CustomNode2D.gd, I get the following error:
Invalid call. Nonexistent function 'function_name' in base 'Area2D (Product.gd)'
So it seems like the issue is the inheritance isn't working for this scene, but it does for the other, why could this be?