Enum Class Sprite

java.lang.Object
java.lang.Enum<Sprite>
edu.uoc.pacman.model.utils.Sprite
All Implemented Interfaces:
Serializable, Comparable<Sprite>, Constable

public enum Sprite extends Enum<Sprite>
Sprite that stores the configuration file symbol and the image's path.
  • Enum Constant Details

    • PACMAN_RIGHT

      public static final Sprite PACMAN_RIGHT
      Sprite when Pacman is facing right.
    • PACMAN_LEFT

      public static final Sprite PACMAN_LEFT
      Sprite when Pacman is facing left.
    • PACMAN_UP

      public static final Sprite PACMAN_UP
      Sprite when Pacman is facing up.
    • PACMAN_DOWN

      public static final Sprite PACMAN_DOWN
      Sprite when Pacman is facing down.
    • BLINKY

      public static final Sprite BLINKY
      Sprite for a Blinky ghost.
    • PINKY

      public static final Sprite PINKY
      Sprite for a Pinky ghost.
    • INKY

      public static final Sprite INKY
      Sprite for an Inky ghost.
    • CLYDE

      public static final Sprite CLYDE
      Sprite for a Clyde ghost.
    • DOT

      public static final Sprite DOT
      Sprite for a dot.
    • ENERGIZER

      public static final Sprite ENERGIZER
      Sprite for an energizer.
    • WALL

      public static final Sprite WALL
      Sprite for a wall.
    • PATH

      public static final Sprite PATH
      Sprite for a piece of path.
    • LIFE

      public static final Sprite LIFE
      Sprite for a life.
  • Field Details

    • symbol

      private final char symbol
      Value in the configuration file.
    • imageSrc

      private final String imageSrc
      Value of the image path.
  • Constructor Details

    • Sprite

      private Sprite(char symbol, String imageSrc)
      Constructor with arguments.
      Parameters:
      symbol - Value of the configuration file symbol.
      imageSrc - Value of the image path.
  • Method Details

    • values

      public static Sprite[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Sprite valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getSymbol

      public char getSymbol()
      Getter of the attribute symbol.
      Returns:
      Current value of the attribute symbol.
    • getImageSrc

      public String getImageSrc()
      Getter of the attribute imageSrc.
      Returns:
      Current value of the attribute imageSrc.