Open
Description
I'm working with embedding Wren and I would like to be able to specify Wren classes which act as "prototypes" for instances of game objects. For example, I'd like to do something akin to:
class Weapon {
shoot() { } // stub implementation
// Register the class on the host
static foreign register(weapon_class)
}
class Revolver is Weapon {
static id { "revolver" } // all instances of revolver should have the same ID, hence static
// instance-specific method
shoot() {
Game.spawn("bullet")
}
}
Weapon.register(Revolver)
And then Weapon.register()
would somehow inspect the Revolver
class in order to pull attributes from it (such as id
). Is an approach like this possible? I'm struggling with figuring out how to call static getters for class Revolver
, and problematically the only way I know how requires calling wrenCall()
during the foreign function, which from what I understand is prohibited.
Metadata
Metadata
Assignees
Labels
No labels