Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public interface EntityFactory
Creates a game’s own entity types from level JSON, for types
LevelData does
not know. Pass one to LevelData#createWorld(long, EntityFactory).Methods
public abstract LevelEntity create(String id, String type, int x, int y, int tileSize, Map<String, Object> spec) | Creates an entity, or declines. |
Method details
create
public abstract LevelEntity create(String id, String type, int x, int y, int tileSize, Map<String, Object> spec)Creates an entity, or declines.
Parameters
idString- the id to give it
typeString- the
typefield xint- the left edge of its cell, fixed point
yint- the top edge of its cell, fixed point
tileSizeint- the tile size, fixed point
specMap<String, Object>- the whole JSON object, for its other fields
Returns
the entity, or null if the type is not this factory’s