Register a class for the objects of a level. The registry is the same
whatever the level was made with: an object of a Tiled or a Sprite Fusion
map, an entity of an LDtk level.
When an object with a matching class or name is found in a level,
an instance of the given constructor will be created with new Constructor(x, y, settings),
settings being the object as the level describes it (a TMXObject
for a Tiled map, an LDtkObjectSettings for an LDtk level).
A tile object with no class of its own is matched by its tile's class, as in
Tiled: give a tile a class in Tiled's tileset editor, and every object placed
from that tile is built by the class registered under that name (an object's
own class or name, when registered, still comes first). The tile's custom
properties are read with TMXObject#resolvedProperty.
This is a convenience wrapper around registerObjectFactory.
If the same class is registered twice with the same constructor, the call is silently ignored.
If a different constructor is registered for the same name, an error is thrown.
Note: classes registered via pool.register are also automatically registered
as Tiled object factories (unless pool.autoRegisterTiled is set to false).
the class or the name the level gives the object
class constructor, given the object's position and the object as the level describes it
The older name of registerObjectClass, from when a Tiled map was the only kind of level: the same function, kept so that existing games and plugins go on working.
Deprecated
since 20.18.0, use registerObjectClass
Template: S
Param: name
the class or name the level gives the object
Param: Constructor
class constructor, given the object's position and its description