Files
GDevelop/GDJS/Runtime/CustomRuntimeObject2D.ts
D8H deb802cfec Allow to override behavior properties on object instances (#8171)
* For now, this is limited to instances inside custom objects. This will be made available in the future for all instances in scenes if this works well.
2026-02-09 16:21:24 +01:00

37 lines
1013 B
TypeScript

namespace gdjs {
/**
* Base class for 2D custom objects.
* @category Objects > Custom Object
*/
export class CustomRuntimeObject2D extends gdjs.CustomRuntimeObject {
constructor(
parent: gdjs.RuntimeInstanceContainer,
objectData: ObjectData & CustomObjectConfiguration,
instanceData?: InstanceData
) {
super(parent, objectData, instanceData);
}
protected override _createRender(): gdjs.CustomRuntimeObject2DRenderer {
const parent = this._runtimeScene;
return new gdjs.CustomRuntimeObject2DRenderer(
this,
this._instanceContainer,
parent
);
}
protected override _reinitializeRenderer(): void {
this.getRenderer().reinitialize(this, this.getParent());
}
override getRenderer(): gdjs.CustomRuntimeObject2DRenderer {
return super.getRenderer() as gdjs.CustomRuntimeObject2DRenderer;
}
override getRendererObject() {
return this.getRenderer().getRendererObject();
}
}
}