コード例 #1
0
 @Override
 public void tick() throws IllegalStateException {
   if (mGameObject == null)
     throw new IllegalStateException("GameObject for AnimationGameComponent is null.");
   if (mCurrentAnimation == null)
     throw new IllegalStateException("Current Animation for AnimationGameComponent is null");
   mCurrentAnimation.tick();
 }
コード例 #2
0
 /**
  * setAnimation sets the current animation being played for the GameObject
  *
  * @param animationName - The name of the animation that should be played
  */
 public void setAnimation(String animationName) throws IllegalStateException {
   try {
     mCurrentAnimation = mGameObjectAnimations.get(animationName);
     mCurrentAnimation.start();
   } catch (NullPointerException e) {
     throw new IllegalStateException(
         "Animation " + animationName + " was never added to AnimationComponent");
   }
 }
コード例 #3
0
 @Override
 public void render(Graphics g) throws IllegalStateException {
   if (mCurrentAnimation == null)
     throw new IllegalStateException("Current Animation for AnimationGameComponent is null");
   g.drawImage(
       mCurrentAnimation.getSprite(),
       mGameObject.getxPosition(),
       mGameObject.getyPosition(),
       null);
 }
コード例 #4
0
 /** stopAnimating will stop the GameObject's animations */
 public void stopAnimating() {
   mCurrentAnimation.stop();
   mCurrentAnimation.reset();
 }