Esempio n. 1
0
 /**
  * Force-sets an image, circumventing the name + ident system.
  *
  * @param name - the image you want to set.
  */
 public void forceImage(String name) {
   sprite = ImageLoader.getSingleImage(name);
   if (sprite == null) System.out.println(name + " null!");
   currImgName = name;
   isTicking = false;
   isLooping = false;
 }
Esempio n. 2
0
 /**
  * Plays an animation once.
  *
  * @param duration_seconds - length of time to play the animation in seconds
  * @param ident - Images are loaded as name+ident (Tavish + _Walk_North)
  */
 public void animate(double duration_seconds, String ident) {
   fireEvent(name + ident, false, true);
   isLooping = false;
   isTicking = true;
   if (currImgName.equalsIgnoreCase(name + ident)) {
     return;
   }
   seriesPosition = 0;
   totalAnimTime_Millis = 0;
   sequenceDuration_Millis = duration_seconds * 1000;
   seriesLength = ImageLoader.getSeriesCount(name + ident);
   cycleLength_Millis = sequenceDuration_Millis / seriesLength;
   currImgName = name + ident;
 }
Esempio n. 3
0
 /** @return the current image for the sprite as a buffered image */
 public BufferedImage getCurrentImage() {
   if (isTicking) return ImageLoader.getGroupedImage(currImgName, seriesPosition);
   return sprite;
 }