Interface EntityFactory


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).
  • Method Summary

    Modifier and Type
    Method
    Description
    create(String id, String type, int x, int y, int tileSize, Map<String,Object> spec)
    Creates an entity, or declines.
  • Method Details

    • create

      LevelEntity create(String id, String type, int x, int y, int tileSize, Map<String,Object> spec)

      Creates an entity, or declines.

      Parameters
      • id: the id to give it
      • type: the type field
      • x: the left edge of its cell, fixed point
      • y: the top edge of its cell, fixed point
      • tileSize: the tile size, fixed point
      • spec: the whole JSON object, for its other fields
      Returns

      the entity, or null if the type is not this factory's