|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjplay.GameObject
jplay.GameImage
jplay.Animation
public class Animation
Class responsible for animating a GameImage using pieces of the image, such as frames.
Field Summary |
---|
Fields inherited from class jplay.GameObject |
---|
height, width, x, y |
Constructor Summary | |
---|---|
Animation(java.lang.String fileName)
Overloading of the constructor public Animation(String fileName, int totalFrames, boolean loop). |
|
Animation(java.lang.String fileName,
int totalFrames)
Overloading of the constructor public Animation(String fileName, int totalFrames, boolean loop). |
|
Animation(java.lang.String fileName,
int totalFrames,
boolean loop)
The constructor creates a class object animation. |
Method Summary | |
---|---|
void |
draw()
Draws the animtion on escreen. |
int |
getCurrFrame()
Returns the number of current frame. |
long |
getDuration(int frame)
Return the time in which the frame is shown on screen. |
int |
getFinalFrame()
Returns the number of final frame of the sequence of frames. |
int |
getInitialFrame()
Returns the number of initial frame. |
long |
getTotalDuration()
Returns the sum of all time frames. |
void |
hide()
This method is responsible for not allowing to drawn the animation on screen. |
boolean |
isLooping()
This method tells whether the animation is looped. |
boolean |
isPlaying()
Returns true if the animation is being executed, false otherwise. |
void |
pause()
Method responsible for pausing the animation. |
void |
play()
Method responsible for starting the execution of the animation. |
void |
setCurrFrame(int frame)
Sets the current frame that will be drawn. |
void |
setDuration(int frame,
long time)
Set up the time which the frame will be shown on screen. |
void |
setFinalFrame(int frame)
Sets the final frame of the sequence of frames. |
void |
setInitialFrame(int frame)
Sets the initial frame of the sequence of frames. |
void |
setLoop(boolean value)
Method responsible for informing the class that the animation will not be run indefinitely. |
void |
setSequence(int initialFrame,
int finalFrame)
Set the initial and final frame in the sequence of animation. |
void |
setSequence(int initialFrame,
int finalFrame,
boolean loop)
Set the initial and final frame in the sequence of animation. |
void |
setSequenceTime(int initialFrame,
int finalFrame,
boolean loop,
long time)
Set the initial and final frame in the sequence of animation, the runtime and if it will run indefinitely. |
void |
setSequenceTime(int initialFrame,
int finalFrame,
long time)
Set the initial and final frame in the sequence of animation and the runtime. |
void |
setTotalDuration(long time)
|
void |
stop()
Stops execution and puts the initial frame as the current frame. |
void |
unhide()
Method responsible for allowing the animation to draw on the screen. |
void |
update()
Method responsible for performing the change of frames. |
Methods inherited from class jplay.GameImage |
---|
loadImage |
Methods inherited from class jplay.GameObject |
---|
collided |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Animation(java.lang.String fileName, int totalFrames, boolean loop)
fileName
- Name and image path.totalFrames
- Number of frames that form the image.It
- says if the animation is performed repeatedly. If the value is
true when the last frame is shown the next frame will be the first.
However, if the value is false when the last frame is shown the animation will
remain showing the last frame indefinitely.public Animation(java.lang.String fileName, int totalFrames)
public Animation(java.lang.String fileName)
Method Detail |
---|
public void setDuration(int frame, long time)
frame
- Number of the frametime
- Milliseconds time which the frame will be shown on screen.public long getDuration(int frame)
frame
- number of frame
public void setSequence(int initialFrame, int finalFrame)
initialFrame
- finalFrame
- public void setSequence(int initialFrame, int finalFrame, boolean loop)
initialFrame
- finalFrame
- loop
- public void setSequenceTime(int initialFrame, int finalFrame, long time)
initialFrame
- finalFrame
- time
- public void setSequenceTime(int initialFrame, int finalFrame, boolean loop, long time)
initialFrame
- finalFrame
- time
- loop
- True for indefinitely, false otherwise.public boolean isLooping()
public void setTotalDuration(long time)
public long getTotalDuration()
public void update()
public void stop()
public void play()
public void pause()
public void setInitialFrame(int frame)
frame
- number of framepublic int getInitialFrame()
public void setFinalFrame(int frame)
frame
- number of frame.public int getFinalFrame()
public void setCurrFrame(int frame)
frame
- number of frame.public int getCurrFrame()
public boolean isPlaying()
public void hide()
public void unhide()
public void setLoop(boolean value)
public void draw()
draw
in class GameImage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |