Class Animation

java.lang.Object
  extended by Animation

public class Animation
extends java.lang.Object

Animation class

Version:
0.91
Author:
Carlos, modifications by Scott

Constructor Summary
Animation(java.lang.String animString, int numFrames, boolean loop)
           
Animation(java.lang.String animString, int numFrames, java.lang.String keyStroke, boolean loop)
          Construct the animation
 
Method Summary
 java.lang.String getAnimString()
          Getter for base string for animation
 greenfoot.GreenfootImage getCurrentImage()
          Getter for current Image
 java.lang.String getKeyStroke()
          Getter for trigger keyStroke
 greenfoot.GreenfootImage getNextFrame()
          Getter for the next frame image update current frame, stop animating if applies, and return the currentImage
 boolean isLastFrame()
          Returns a boolean telling wether or not the animation is in its last frame
 greenfoot.GreenfootImage resetAnimation()
          Reset this animation to frame 0
 void scaleAnimation(double scaleFactor)
           
 void ScaleImage(greenfoot.GreenfootImage theImage, double scaleFactor)
           
 void stopAnimation()
          Stop Animating
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Animation

public Animation(java.lang.String animString,
                 int numFrames,
                 boolean loop)

Animation

public Animation(java.lang.String animString,
                 int numFrames,
                 java.lang.String keyStroke,
                 boolean loop)
Construct the animation

Parameters:
animString - base word for the animation (if the pictures are actor1.png,actor2.png, actor3.png, then the animString is actor
numFrames - number of frames in this animation
keystroke - keyStroke that triggers this animation
loop - whether the animation loops or not
Method Detail

getAnimString

public java.lang.String getAnimString()
Getter for base string for animation


getCurrentImage

public greenfoot.GreenfootImage getCurrentImage()
Getter for current Image

Parameters:
original - true if want to return the original image, false if want to return mirror image
Returns:
current GreenfootImage

getKeyStroke

public java.lang.String getKeyStroke()
Getter for trigger keyStroke


getNextFrame

public greenfoot.GreenfootImage getNextFrame()
Getter for the next frame image update current frame, stop animating if applies, and return the currentImage

Parameters:
original - true if want to return the original image, false if want to return mirror image

isLastFrame

public boolean isLastFrame()
Returns a boolean telling wether or not the animation is in its last frame


resetAnimation

public greenfoot.GreenfootImage resetAnimation()
Reset this animation to frame 0


scaleAnimation

public void scaleAnimation(double scaleFactor)

ScaleImage

public void ScaleImage(greenfoot.GreenfootImage theImage,
                       double scaleFactor)

stopAnimation

public void stopAnimation()
Stop Animating