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
-
currentFrame
-
-
height
-
-
hFrames
-
-
image
-
-
numFrames
-
-
owner
-
-
velocity_x
-
-
velocity_y
-
-
width
-
-
wrapAround
-
-
x
-
-
x_old
-
-
y
-
-
y_old
-
-
Actor()
-
-
bounceOff(Actor)
- Bounce off the specified Actor.
-
calculateCurrentFrame()
- Calculates the current frame.
-
calculateNewPosition()
- Calculates the new X and Y position based on velocity and time.
-
calculateNewVelocity()
- Override this to provide your own behaviour.
-
checkForOutOfBounds()
- Check for out of bounds and wrap if it is.
-
collideWithActor(Actor)
- Override this method to handle the case when Actor collides with another.
-
draw(Graphics)
- Each Actor is handed a g and is expected to draw itself in it.
-
setImage(Image)
- Set the image used for animation.
-
setImage(Image, int, int)
- Set the image used for animation.
-
setImage(Image, int, int, int, int)
- Set the image used for animation.
-
tick()
- Change animation frame, calculate new position, and calculate new velocity..
image
protected Image image
numFrames
protected int numFrames
width
public int width
height
public int height
currentFrame
public int currentFrame
hFrames
protected int hFrames
x
public double x
y
public double y
x_old
public double x_old
y_old
public double y_old
velocity_x
public double velocity_x
velocity_y
public double velocity_y
owner
public Gamelet owner
wrapAround
public boolean wrapAround
Actor
public Actor()
tick
public void tick()
- Change animation frame, calculate new position, and calculate new velocity..
setImage
protected void setImage(Image theImage,
int frameXSize,
int frameYSize,
int framesHorizontally,
int totalFrames)
- Set the image used for animation.
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.
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.
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.
calculateNewVelocity
protected void calculateNewVelocity()
- Override this to provide your own behaviour.
calculateCurrentFrame
protected void calculateCurrentFrame()
- Calculates the current frame. Behaviour is to flip through frames sequentially
and loop.
checkForOutOfBounds
protected void checkForOutOfBounds()
- Check for out of bounds and wrap if it is.
draw
public void draw(Graphics g)
- Each Actor is handed a g and is expected to draw itself in it.
collideWithActor
protected void collideWithActor(Actor theActor)
- Override this method to handle the case when Actor collides with another.
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