Class Key

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

    public class Key
    extends Object
    implements Constants
    This class contains the key
    • Constructor Detail

      • Key

        public Key​(Scene scene,
                   Cell cell)
        Initialize the key
        Parameters:
        scene - The scene the key is in
        cell - The cell the key is in
    • Method Detail

      • getAnimationWidth

        public int getAnimationWidth()
        Get the width of the key animation
        Returns:
        Returns the key animation width
      • playGetKeySound

        public void playGetKeySound()
        Play the get key sound
      • setSound

        public void setSound​(Sound sound)
        Set the sound the key object will use
        Parameters:
        sound - The sound to use
      • getKey

        public void getKey()
        Get the key
      • getState

        public Key.State getState()
        Get the current state of the key
        Returns:
        Returns the key's state
      • setState

        public void setState​(Key.State state)
        Set the new state of the key
        Parameters:
        state - The new state of the key
      • run

        public void run()
        This 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 key 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