Class FPanelMenu.ThreadMenu

java.lang.Object
java.lang.Thread
fr.formiko.views.gui2d.FPanelMenu.ThreadMenu
All Implemented Interfaces:
Runnable
Enclosing class:
FPanelMenu

class FPanelMenu.ThreadMenu extends Thread
Update the position of animate item on the menu screen.
  • Field Details

    • running

      private boolean running
    • flyingCreature

      private BufferedImage flyingCreature
    • x

      private double x
    • y

      private double y
    • angle

      private double angle
    • watchingCircle

      private double watchingCircle
    • p

      private FPanel p
    • container

      private FPanel container
    • MAX_STARTING_Y

      private static int MAX_STARTING_Y
    • MAX_Y

      private static int MAX_Y
    • MIN_Y

      private static int MIN_Y
    • MAX_MOVING_SPEED

      private static int MAX_MOVING_SPEED
  • Constructor Details

    • ThreadMenu

      public ThreadMenu(FPanel container)
      Main constructor.
      Parameters:
      container - the container of the Panel were the image is draw
  • Method Details

    • setRunning

      private void setRunning(boolean b)
    • getX

      private double getX()
    • getY

      private double getY()
    • getXCentered

      private double getXCentered()
    • getYCentered

      private double getYCentered()
    • getWatchingCircle

      private double getWatchingCircle()
    • run

      public void run()
      Update the position of animate item on the menu screen.
      It initialize the panel & then move the images
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • iniXY

      private void iniXY()
      Initialize x & y.
      x is before the left of the screen. y is random in [0;MAX_STARTING_Y].
    • moveAngleTo

      private void moveAngleTo(double newAngle)
      Move angle to the new angle value, but slowly.
    • mooveToMouse

      private void mooveToMouse()
      Move closer to the mouse at max speed.
    • getDistance

      private double getDistance()
      Return the distance between the mouse location & the Creature location.
    • isCloseToMouse

      private boolean isCloseToMouse()
      Test if Creature is close enoth of mouse.
    • updateLocation

      private void updateLocation()
      Update the position of animate item for 1 step.
    • iniPanel

      private void iniPanel()
      It initialize the panel.