Godot Version
Godot 4.4
Question
I am having trouble tracking an issue I am having with inheritance
extends RigidBody2D
class_name CurrencyBody
enum VARIANT {SINGLE_PAGE, SCROLL_STACK}
const SCENE_PATHS: Dictionary[VARIANT, PackedScene] = {
VARIANT.SINGLE_PAGE: preload("res://scenes/objects/pickables/currency_single_page.tscn"),
VARIANT.SCROLL_STACK: preload("res://scenes/objects/pickables/currency_scroll_stack.tscn")
}
static func new_currency_body(variant:VARIANT) -> CurrencyBody:
var new_currency_body: CurrencyBody = SCENE_PATHS[variant].instantiate()
return new_currency_body
this leads to Parser Error: Could not resolve class "CurrencyBody".
but if I comment any of the two variants out in the dictionary, it works…
const SCENE_PATHS: Dictionary[VARIANT, PackedScene] = {
VARIANT.SINGLE_PAGE: preload("res://scenes/objects/pickables/currency_single_page.tscn"),
#VARIANT.SCROLL_STACK: preload("res://scenes/objects/pickables/currency_scroll_stack.tscn")
}
Each scene root node is a new class which extends CurrencyBody.
Any help would be greatly appreciated!