Class Chest

  • All Implemented Interfaces:
    Constants, java.lang.Runnable

    public class Chest
    extends Object
    implements Constants
    This class handles the chests
    • Constructor Detail

      • Chest

        public Chest​(Scene scene,
                     Cell cell)
        Initialize the chest
        Parameters:
        scene - The scene the chest is in
        cell - The cell that contains the chest
    • Method Detail

      • getState

        public Chest.State getState()
        Get the state of the chest
        Returns:
        Returns the current state
      • setState

        public void setState​(Chest.State state)
        Sets the state of the chest
        Parameters:
        state - The new state of the chest
      • getGem

        public Gem getGem()
        Get the gem from the chest
        Returns:
        The gem in the chest
      • setGem

        public void setGem​(Gem gem)
        Put a gem in the chest
        Parameters:
        gem - The gem
      • setSound

        public void setSound​(Sound sound)
        Set the chest open sound
        Parameters:
        sound - The sound to use
      • run

        public void run()
        This method is run when the thread starts
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class Object
      • checkPosition

        public boolean checkPosition​(int x,
                                     int y)
        Check what position the chest is located at
        Parameters:
        x - The x position to compare
        y - The y position to compare
        Returns:
        Returns true if it is the same position or false otherwise