床や壁を作るクラスWallBlock

こんな感じです。

こんな感じです。

  • タグ:
  • タグはありません
class WallBlock {
  //属性
  PImage wall;
  float wallX, wallY;

  //コンストラクタ
  WallBlock(String name, int tate, int yoko) {
    imageMode(CORNER);
    wall = loadImage("WallBlock.png");

    wallX = yoko;
    wallY = tate;
  }

  void update() {
    for ( tate = 0; tate < 21; tate++ ) {
      for ( yoko = 0; yoko < 12; yoko++ ) {
        if (( yoko == 0 )||( yoko == 11)||( tate == 20 )) {
          stage[tate][yoko] = 9;
          wallX = yoko*35;
          wallY = tate*35;
          image(wall, wallX, wallY);
        }else {
          stage[tate][yoko] = 0;
        }
      }
    }
  }
}