Class CreatureMapObjectLoader
java.lang.Object
de.gurkenlabs.litiengine.environment.MapObjectLoader
de.gurkenlabs.litiengine.environment.CreatureMapObjectLoader
- All Implemented Interfaces:
IMapObjectLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CreaturecreateNewCreature(Environment environment, IMapObject mapObject, String spriteSheet) load(Environment environment, IMapObject mapObject) Loads entities from the specified map object within the given environment.static <T extends Creature>
voidregisterCustomCreatureType(Class<T> creatureType) Registers a customCreatureimplementation that can be automatically provided by thisMapObjectLoader.static <T extends Creature>
voidregisterMapObjectImplementation(String id, Class<T> creatureType) Methods inherited from class MapObjectLoader
afterLoad, getMapObjectType, isMatchingType, loadDefaultProperties
-
Constructor Details
-
CreatureMapObjectLoader
protected CreatureMapObjectLoader()
-
-
Method Details
-
registerCustomCreatureType
Registers a custom
Creatureimplementation that can be automatically provided by thisMapObjectLoader.This should only be used if the particular implementation doesn't require any additional map object properties to be initialized.
Make sure that the implementation has the following present:
- An
AnimationInfoannotation with one or more sprite prefixes defined - Either an empty constructor or a constructor that takes in the sprite prefix from the loader.
The latter is particularly useful for classes that can have different sprite sheets, i.e. share the same logic but might have a different appearance.
- Type Parameters:
T- The type of the custom creature implementation.- Parameters:
creatureType- The class of the customCreatureimplementation.
- An
-
registerMapObjectImplementation
-
load
Description copied from interface:IMapObjectLoaderLoads entities from the specified map object within the given environment.- Parameters:
environment- The environment in which the entities are being loaded.mapObject- The map object containing the data for the entities.- Returns:
- A collection of
IEntityinstances loaded from the map object.
-
createNewCreature
protected Creature createNewCreature(Environment environment, IMapObject mapObject, String spriteSheet)
-