Package snap.viewx

Class GameActor

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class GameActor extends ImageView
This class represents a game character in a GameView.
  • Constructor Details

    • GameActor

      public GameActor()
      Constructor.
  • Method Details

    • getCenterX

      public double getCenterX()
      Returns the center X.
    • getCenterY

      public double getCenterY()
      Returns the center Y.
    • getCellX

      public int getCellX()
      Returns the cell X.
    • getCellY

      public int getCellY()
      Returns the cell Y.
    • moveBy

      public void moveBy(double aCount)
      Move sprite forward.
    • moveTo

      public void moveTo(double anX, double aY)
      Move sprite to a point using setRotation and moveBy (so pen drawing works).
    • turnBy

      public void turnBy(double theDegrees)
      Turn sprite by given degrees.
    • scaleBy

      public void scaleBy(double aScale)
      Scale actor by given amount.
    • intersects

      public boolean intersects(double aX, double aY, double aW, double aH)
      Returns whether actor intersects given rect in local coords.
    • getActorsInRange

      public <T extends GameActor> List<T> getActorsInRange(double aRadius, Class<T> aClass)
      Returns the actors in range.
    • getAngle

      public double getAngle(String aName)
      Returns the angle to the mouse point.
    • getAngle

      public double getAngle(double mx, double my)
      Returns the angle to the mouse point.
    • getDistance

      public double getDistance(String aName)
      Returns the distance to the mouse point.
    • getDistance

      public double getDistance(GameActor anActor)
      Returns the distance to the given actor.
    • getDistance

      public double getDistance(double x2, double y2)
      Returns the distance to the given point.
    • getPen

      public snap.viewx.GamePen getPen()
      Returns the pen.
    • getPenPoint

      public Point getPenPoint()
      Returns the pen point.
    • setPenColor

      public void setPenColor(String aString)
      Sets the pen color.
    • penDown

      public void penDown()
      Set pen down.
    • setShowing

      protected void setShowing(boolean aValue)
      Override to update pen location.
      Overrides:
      setShowing in class View
    • getGameView

      public GameView getGameView()
      Returns the GameView.
    • main

      protected void main()
      The main execution loop.
    • act

      protected void act()
      The act method.