Class Material

java.lang.Object
com.codename1.gaming.level.Material

public class Material extends Object
A pluggable surface material used by terrain cells and TerrainFeatures. A material is referenced everywhere by its string #getId() and resolved through the MaterialRegistry, so applications can register their own materials (sand, lava, ice, ...) without changing the level format. Carries authoring + light-runtime hints (base colour, whether it blocks movement, friction) plus an optional #getArtId() for textured rendering.
  • Constructor Details

    • Material

      public Material()
    • Material

      public Material(String id, String name, int color)
  • Method Details

    • getId

      public String getId()
    • setId

      public Material setId(String id)
    • getName

      public String getName()
    • setName

      public Material setName(String name)
    • getColor

      public int getColor()
      Base RGB colour (0xRRGGBB) used to render the material before art is applied.
    • setColor

      public Material setColor(int color)
    • isSolid

      public boolean isSolid()
      Whether walkers are blocked by this material (e.g. water, lava).
    • setSolid

      public Material setSolid(boolean solid)
    • getFriction

      public double getFriction()
      Movement friction multiplier (1 = normal, <1 = slippery like ice).
    • setFriction

      public Material setFriction(double friction)
    • getArtId

      public String getArtId()
      Optional asset id supplying the material's texture art (resolved via AssetCatalog).
    • setArtId

      public Material setArtId(String artId)
    • props

      public Map<String,Object> props()
      Free-form authoring properties for app-specific material data.