Class com.next.gt.Actor
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.next.gt.Actor

java.lang.Object
   |
   +----com.next.gt.Actor

public class Actor
extends Object

Variable Index

 o currentFrame
 o height
 o hFrames
 o image
 o numFrames
 o owner
 o velocity_x
 o velocity_y
 o width
 o wrapAround
 o x
 o x_old
 o y
 o y_old

Constructor Index

 o Actor()

Method Index

 o bounceOff(Actor)
Bounce off the specified Actor.
 o calculateCurrentFrame()
Calculates the current frame.
 o calculateNewPosition()
Calculates the new X and Y position based on velocity and time.
 o calculateNewVelocity()
Override this to provide your own behaviour.
 o checkForOutOfBounds()
Check for out of bounds and wrap if it is.
 o collideWithActor(Actor)
Override this method to handle the case when Actor collides with another.
 o draw(Graphics)
Each Actor is handed a g and is expected to draw itself in it.
 o setImage(Image)
Set the image used for animation.
 o setImage(Image, int, int)
Set the image used for animation.
 o setImage(Image, int, int, int, int)
Set the image used for animation.
 o tick()
Change animation frame, calculate new position, and calculate new velocity..

Variables

 o image
  protected Image image
 o numFrames
  protected int numFrames
 o width
  public int width
 o height
  public int height
 o currentFrame
  public int currentFrame
 o hFrames
  protected int hFrames
 o x
  public double x
 o y
  public double y
 o x_old
  public double x_old
 o y_old
  public double y_old
 o velocity_x
  public double velocity_x
 o velocity_y
  public double velocity_y
 o owner
  public Gamelet owner
 o wrapAround
  public boolean wrapAround

Constructors

 o Actor
  public Actor()

Methods

 o tick
  public void tick()
Change animation frame, calculate new position, and calculate new velocity..
 o setImage
  protected void setImage(Image theImage,
                          int frameXSize,
                          int frameYSize,
                          int framesHorizontally,
                          int totalFrames)
Set the image used for animation.
 o setImage
  protected void setImage(Image theImage)
Set the image used for animation. Good for an image that has all frames within it and none empty.
 o setImage
  protected void setImage(Image theImage,
                          int horizontalFrames,
                          int totalFrames)
Set the image used for animation. Good for an image that has some empty frames within it.
 o calculateNewPosition
  protected void calculateNewPosition()
Calculates the new X and Y position based on velocity and time. Also may check if Actor needs to wrap around at the edges if the wraparound flag is set.
 o calculateNewVelocity
  protected void calculateNewVelocity()
Override this to provide your own behaviour.
 o calculateCurrentFrame
  protected void calculateCurrentFrame()
Calculates the current frame. Behaviour is to flip through frames sequentially and loop.
 o checkForOutOfBounds
  protected void checkForOutOfBounds()
Check for out of bounds and wrap if it is.
 o draw
  public void draw(Graphics g)
Each Actor is handed a g and is expected to draw itself in it.
 o collideWithActor
  protected void collideWithActor(Actor theActor)
Override this method to handle the case when Actor collides with another.
 o bounceOff
  public void bounceOff(Actor theActor)
Bounce off the specified Actor. Changes it's velocity so that it appears to bounce off.

All Packages  Class Hierarchy  This Package  Previous  Next  Index