Class AnimatedImage

java.lang.Object
  extended by AnimatedImage

public class AnimatedImage
extends java.lang.Object

AnimatedImage Class This class is for creating a collection of GreenfootImages to appear as frames. The frames are created from using a single greenfoot image. The class will create an image for each frame, and draw the image for that frame from the image supplied. It will then be stored as a Greenfoot Image in a collection.


Constructor Summary
AnimatedImage(java.lang.String fileName, int noFrames, int frameWidth, int frameHeight)
          The constructor, which creates all the indevidual frames from the image supplied.
 
Method Summary
 greenfoot.GreenfootImage getFrame(int frame)
          Returns a frame based on the index value used.
 int getFrameHeight()
          Returns the height of each frame.
 int getFrameWidth()
          Returns the width of each frame.
 int getNumberOfFrames()
          Returns the number of frames in this animated image type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimatedImage

public AnimatedImage(java.lang.String fileName,
                     int noFrames,
                     int frameWidth,
                     int frameHeight)
The constructor, which creates all the indevidual frames from the image supplied. The image should contain enough space to house each frame exactly. Otherwise frames may not be drawn correctly.

Parameters:
fileName - the name of the image
noFrames - the number of frames in the image
frameWidth - the width of each frame
frameHeight - the height of each frame
Method Detail

getFrame

public greenfoot.GreenfootImage getFrame(int frame)
Returns a frame based on the index value used.

Parameters:
frame - the index number of the frame you require
Returns:
the Greenfoot Image for that frame

getFrameHeight

public int getFrameHeight()
Returns the height of each frame. This height is the same for all frames.

Returns:
the height of every frame.

getFrameWidth

public int getFrameWidth()
Returns the width of each frame. This width is the same for all frames.

Returns:
the width of every frame.

getNumberOfFrames

public int getNumberOfFrames()
Returns the number of frames in this animated image type

Returns:
the number of frames