Class Person

  • Direct Known Subclasses:
    Npc

    public class Person
    extends Cell
    Class managing Player
    • Field Detail

      • map

        private final Map map
      • directionMove

        private int directionMove
      • directionSight

        private int directionSight
      • directionMoveLast

        private int directionMoveLast
      • isMoving

        private boolean isMoving
      • isInEvent

        private static boolean isInEvent
      • distanceOfAnimation

        private int distanceOfAnimation
      • time

        private long time
    • Constructor Detail

      • Person

        public Person​(Map map)
      • Person

        public Person​(int x,
                      int y,
                      Map map)
    • Method Detail

      • getMap

        public Map getMap()
      • setDirectionMoveLast

        public void setDirectionMoveLast​(int directionMoveLast)
      • setDirectionSight

        public void setDirectionSight​(int directionSight)
      • setDirectionMove

        public void setDirectionMove​(int directionMove)
      • setImagePerson

        public void setImagePerson​(java.lang.String name,
                                   java.awt.Rectangle[] rectangles)
      • move

        public void move()
        Checks for user input then checks if movement is possible then moves Player
      • isEventInFront

        private boolean isEventInFront​(int x,
                                       int y,
                                       int directionSight)
        Checks if there is an Event cell in front of Player
        Parameters:
        x - X position of Player
        y - Y position of Player
        directionSight - direction of sight of Player
        Returns:
        true if there is an event in front of Player
      • isDoorInFront

        private boolean isDoorInFront​(int x,
                                      int y,
                                      int directionSight)
        Checks if there is a Door cell in front of Player
        Parameters:
        x - X position of Player
        y - Y position of Player
        directionSight - direction of sight of Player
        Returns:
        true if there is a door in front of Player
      • isChestInFront

        private boolean isChestInFront​(int x,
                                       int y,
                                       int directionSight)
        Checks if there is a Chest cell in front of Player
        Parameters:
        x - X position of Player
        y - Y position of Player
        directionSight - direction of sight of Player
        Returns:
        true if there is a chest in front of Player
      • paint

        public void paint​(java.awt.Graphics2D g)
        Overrides:
        paint in class Cell
      • animateMove

        public void animateMove​(java.awt.Graphics2D g,
                                int direction)
        Animates Players move throughout the map
        Parameters:
        g - graphics for painting
        direction - Player's movement direction
      • getIsMoving

        public boolean getIsMoving()
      • setIsMoving

        public void setIsMoving​(boolean isMoving)
      • setDistance

        public void setDistance​(int distance)
      • getDistance

        public int getDistance()
      • getDirectionMoveLast

        public int getDirectionMoveLast()
      • setInEvent

        public static void setInEvent​(boolean isInEvent)
      • getDirectionSight

        public int getDirectionSight()
      • isInEvent

        public static boolean isInEvent()