示例#1
0
 private void runAnimation() {
   if (Time.getTime() > (frameDelay + frameTime)) {
     if (currentFrame >= frameAmount) {
       currentFrame = 0;
     } else {
       currentFrame++;
     }
     frameTime = Time.getTime();
   }
 }
示例#2
0
 public void setAnimationData(String animationData) {
   if (animationData.contains("X")) {
     String a[] = animationData.split("X");
     frameDirection = "X";
     frameTime = Time.getTime();
     frameAmount = Integer.parseInt(a[0]);
     frameDelay = Integer.parseInt(a[1]);
     animationEnabled = true;
   } else if (animationData.contains("Y")) {
     String a[] = animationData.split("Y");
     frameDirection = "Y";
     frameTime = Time.getTime();
     frameAmount = Integer.parseInt(a[0]);
     frameDelay = Integer.parseInt(a[1]);
     animationEnabled = true;
   }
 }