Class MapSector

    • Constructor Detail

      • MapSector

        public MapSector​(Map parent,
                         int number)
        Creates a new map sector, then calls buildTiles()
    • Method Detail

      • init

        public abstract void init()
      • render

        public void render​(org.newdawn.slick.Graphics graphics)
        Minimum requirement for rendering, must be called first in any implementation
      • drawTiles

        protected void drawTiles​(org.newdawn.slick.Graphics graphics)
        Renders all of the sector's tiles
        Parameters:
        graphics - The graphics to use
      • buildTiles

        private void buildTiles()
        Populate tiles with MapTile objects, defined in the sector's .def file
      • fill

        private void fill​(java.lang.String id)
      • mixed

        private void mixed​(org.json.JSONArray custom,
                           java.util.ArrayList<java.lang.String> tileIDs,
                           java.util.ArrayList<java.lang.String> tileKeys)
      • tick

        public void tick()
        Minimum requirement for each tick, must be called first in any implementation
        Specified by:
        tick in interface Tickable
      • onPlayerEnter_internal

        public void onPlayerEnter_internal()
      • onPlayerLeave_internal

        public void onPlayerLeave_internal()
      • setSpecialCollisions

        public abstract void setSpecialCollisions()
        Set sector-specific, or "special" collisions, such as ones that have to do with a quest
      • onPlayerEnter

        public abstract void onPlayerEnter​(MapSector from)
      • onPlayerLeave

        public abstract void onPlayerLeave​(MapSector to)
      • updatePlayerPosition

        protected void updatePlayerPosition​(MapSector from)
        Updates the player's position in accordance with the sector they just came from
        Parameters:
        from - Where the player is coming from
      • playerEnteredFrom

        private void playerEnteredFrom​(int direction)
        Update, or "correct", the player's position based on what direction it came from
        Parameters:
        direction - The direction from where the player came into this sector
        See Also:
        TOP, BOTTOM, LEFT, RIGHT
      • addEntity

        public void addEntity​(Entity e)
      • addEntity

        public void addEntity​(Entity e,
                              boolean primary)
      • removeEntity

        public void removeEntity​(Entity e)
      • removeEntity

        public void removeEntity​(Entity e,
                                 boolean primary)
      • addTickable

        public void addTickable​(Tickable tickable)
      • removeTickable

        public void removeTickable​(Tickable tickable)
      • addRenderable

        public void addRenderable​(Renderable renderable)
      • removeRenderable

        public void removeRenderable​(Renderable renderable)
      • setNeighborAt

        public void setNeighborAt​(MapSector neighbor,
                                  byte direction)
        Sets a neighboring sector in the direction, as well as reciprocating it
        Parameters:
        neighbor - The sector to set as a neighbor
        direction - TOP, LEFT, BOTTOM, or RIGHT
      • setNeighborAt

        private void setNeighborAt​(MapSector neighbor,
                                   byte direction,
                                   boolean didSetInverse)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        parent, sector index
        See Also:
        parent