floorturn.java

来自「一个经典的手机游戏原代码」· Java 代码 · 共 62 行

JAVA
62
字号
import javax.microedition.lcdui.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class floorTurn extends floorSprite {
  private int iStop;
  public floorTurn(Image img , int frameWidth, int frameHeight,
                   int scnWidth, int scnHeight) {
    super(img, frameWidth, frameHeight, scnWidth, scnHeight);
    iStop = 0;
  }



  void doOn(playerSprite tempPlayer) {
    /**@todo Implement this floor abstract method*/
    if (isDoLive == false) {
      tempPlayer.addLive();
      isDoLive = true;
    }
    switch (this.getFrame()) {
      case 1:
        tempPlayer.move(0, FLOOR_MOVE * -1);
        this.nextFrame();
        break;
      case 0:
        tempPlayer.move(0, FLOOR_MOVE * -1);
        if (iStop != 3)
          iStop++;
        else {
          iStop = 0;
          this.nextFrame();
          isTurn = true;
        }
        break;
      case 2:

//          tempPlayer.moveDown();
        tempPlayer.isDown = true;
        this.nextFrame();
        break;
      case 3:
        isTurn = false;
        break;
    }
  }

  void autoAction() {
    if (isTurn == true && this.getFrame() == 3) {
      this.nextFrame();
      isTurn = false;
    }
  }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?