⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arkanoidcanvas.java

📁 Arkanoid, game for mobile device It containt only source code, not any document related.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        drawScore(g, false);
        Doh = 0;
        DLT = 0;
        Scene = 70;
      }
    } else {
      PlayPhrase(ph[10], 1, 64);
    }
    return 0;
  }

  public void wallBreak(Graphics g, int i, int j, int k) {
    Wc--;
    g.drawImage(Img_bg[ ( (Wd[k] & 0xf0000) >> 16) - 1], i - 5, j - 5, 0x10 | 4);
    if ( (Wd[k] & 0x40) == 64 && (Wd[k] & 9) != 9) {
      for (int l = 0; l < 2; l++) {
        if (Riy[l] != 0) {
          continue;
        }
        Rix[l] = i;
        Riy[l] = j;
        Rin[l] = Id[next_item];
        next_item++;
        break;
      }

    }
  }

  public void Disruption() {
    int i1 = 1;
    int i = 0;
    for (; i1 < 8; i1++) {
      if (Lv[i1] == 1 && Typ[i1] < Typ[i]) {
        i = i1;

      }
    }
    int l = Txp[i];
    i1 = Typ[i];
    int j1 = Txp0[i];
    int k1 = Typ0[i];
    int l1 = Tdx[i];
    int i2 = Tdy[i];
    int j2 = l1 * -1;
    int k2 = i2 * -1;
    int l2 = di[i];
    for (int j = 0; j < 8; j++) {
      if (Lv[j] == 0) {
        Txp[j] = l;
        Typ[j] = i1;
        Txp0[j] = j1;
        Typ0[j] = k1;
        Tdx[j] = l1;
        Tdy[j] = i2;
        di[j] = l2;
      }
    }

    if (Lv[1] == 0) {
      Tdx[1] = j2;
      Tdy[1] = k2;
    }
    if (Lv[2] == 0) {
      Tdx[2] = j2;
    }
    if (Lv[3] == 0) {
      Tdy[3] = k2;
    }
    if (l2 < 3) {
      di[4] = 5;
    } else {
      di[4] = 0;
    }
    di[5] = di[6] = di[7] = di[4];
    if (Lv[5] == 0) {
      Tdx[5] = j2;
      Tdy[5] = k2;
    }
    if (Lv[6] == 0) {
      Tdx[6] = j2;
    }
    if (Lv[7] == 0) {
      Tdy[7] = k2;
    }
    for (int k = 0; k < 8; k++) {
      Lv[k] = 1;

    }
  }

  public void DisruptionOff(Graphics g) {
    int i = 1;
    int j = 0;
    for (; i < 8; i++) {
      Lv[i] = 0;
      if (Typ[i] < Typ[j]) {
        j = i;
      }
    }

    Txp[0] = Txp[j];
    Typ[0] = Typ[j];
    Txp0[0] = Txp0[j];
    Typ0[0] = Typ0[j];
    Tdx[0] = Tdx[j];
    Tdy[0] = Tdy[j];
    di[0] = di[j];
    Lv[0] = 1;
  }

  public void MegaBall() {
    int i1 = 1;
    int i = 0;
    for (; i1 < 8; i1++) {
      if (Lv[i1] == 1 && Typ[i1] < Typ[i]) {
        i = i1;

      }
    }
    int l = Txp[i];
    i1 = Typ[i];
    int j1 = Txp0[i];
    int k1 = Typ0[i];
    int l1 = Tdx[i];
    int i2 = Tdy[i];
    int j2 = l1 * -1;
    int k2 = i2 * -1;
    int l2 = di[i];
    for (int j = 0; j < 8; j++) {
      if (Lv[j] == 0) {
        Txp[j] = l;
        Typ[j] = i1;
        Txp0[j] = j1;
        Typ0[j] = k1;
        Tdx[j] = l1;
        Tdy[j] = i2;
        di[j] = l2;
      }
    }

    for (int k = 0; k < 8; k++) {
      Lv[k] = 1;

    }
  }

  public void MegaBallOff(Graphics g) {
    for (int i = 1; i < 8; i++) {
      Lv[i] = 0;

    }
  }

  public void drawThunder(Graphics g) {
    if (Tn != 0) {
      if (Tn == 1) {
        g.setColor(255, 0, 0);
        Tn = 2;
      } else
      if (Tn == 2) {
        g.setColor(0, 255, 0);
        Tn = 3;
      } else
      if (Tn == 3) {
        g.setColor(0, 0, 255);
        Tn = 1;
      }
      g.drawLine(5, 125, 103, 125);
    }
  }

  public void drawLaser(Graphics g) {
    for (int i = 0; i < 2; i++) {
      if (Liy[i] != 0) {
        int j = ( (Lix[i] + 1) - 5) / 10;
        int k = (Liy[i] - 5) / 5;
        int k1 = ( (Lix[i] + 8) - 5) / 10;
        int l = j * 10 + 5;
        int i1 = k * 5 + 5;
        int l1 = k1 * 10 + 5;
        int j1 = k * 10 + j;
        int i2 = k * 10 + k1;
        if (k > 0 && k <= 16 && Liy[i] == i1) {
          if ( (Wd[j1 - 10] & 0xf) != 0) {
            if (Ll[i] == 0) {
              wallHit(g, j1 - 10, l, i1 - 5, 1);
              Lh[i] = 0;
            } else {
              Lh[i] = wallHit(g, j1 - 10, l, i1 - 5, Lh[i]);
            }
          }
          if ( (Wd[i2 - 10] & 0xf) != 0 && j1 != i2) {
            if (Ll[i] == 0) {
              wallHit(g, i2 - 10, l1, i1 - 5, 1);
              Lh[i] = 0;
            } else {
              Lh[i] = wallHit(g, i2 - 10, l1, i1 - 5, Lh[i]);
            }
          }
          if (Lh[i] == 0) {
            Liy[i] = 0;
            Ll[i] = 0;
            Lh[i] = 5;
          }
        }
        if (Liy[i] <= 4) {
          Liy[i] = 0;
          Ll[i] = 0;
          Lh[i] = 5;
          return;
        }
        Liy[i] -= 5;
        if (Ll[i] == 0) {
          g.drawImage(Img_laser[0], Lix[i], Liy[i], 0x10 | 4);
        } else {
          g.drawImage(Img_laser[1], Lix[i], Liy[i], 0x10 | 4);
        }
      }
    }

  }

  public void drawDohcolor(Graphics g) {
    if (Dc > 0) {
      g.drawImage(Img_doh[Dc - 1], 29, 15, 0x10 | 4);
      Dc++;
      if (Dc >= 5) {
        Dc = 0;
      }
    }
  }

  public void drawDohcolor7650(Graphics g) {
    try {
      if (Dc > 0) {
        g.drawImage(Img_doh[Dc - 1], getWidth() >> 1, 60, 0x10 | 1);
        ArkanoidCanvas _tmp = this;
        Thread.sleep(250L);
        Dc++;
        if (Dc >= 5) {
          Dc = 0;
        }
      }
    } catch (Exception exception) {}
  }

  public void drawDohLaser(Graphics g) {
    DLT++;
    if (DLT >= 100) {
      if (Dlf == 1) {
        g.setColor(255, 0, 0);
        Dlf = 2;
      } else
      if (Dlf == 2) {
        g.setColor(0, 255, 0);
        Dlf = 3;
      } else
      if (Dlf == 3) {
        g.setColor(0, 0, 255);
        Dlf = 1;
      }
      g.fillArc(43, 29, 6, 6, 0, 360);
      g.fillArc(59, 29, 6, 6, 0, 360);
      if (DLT == 150) {
        if (Vxp + 10 < 29) {
          DLxe = 17;
          DLye = 129;
        } else
        if (Vxp + 10 < 54) {
          DLxe = 42;
          DLye = 129;
        } else
        if (Vxp + 10 < 79) {
          DLxe = 67;
          DLye = 129;
        } else {
          DLxe = 92;
          DLye = 129;
        }
        DLx[0] = 47;
        DLy[0] = 35;
        DLx[1] = 64;
        DLy[1] = 35;
        DLxb[0] = 47;
        DLyb[0] = 35;
        DLxb[1] = 64;
        DLyb[1] = 35;
        PlayPhrase(ph[12], 1, 64);
      } else
      if (DLT >= 150) {
        boolean flag = false;
        boolean flag1 = false;
        boolean flag2 = false;
        boolean flag3 = false;
        for (int i2 = 0; i2 < 2; i2++) {
          int k = DLxe;
          int l = DLye;
          int i = k - DLx[i2];
          int j = l - DLy[i2];
          if (i < 0) {
            i *= -1;
          }
          if (j < 0) {
            j *= -1;
          }
          if (i > j) {
            byte byte0;
            if (DLx[i2] > k) {
              byte0 = ( (byte) (DLy[i2] <= l ? -1 : 1));
              int i1 = DLx[i2];
              DLx[i2] = k;
              k = i1;
              DLy[i2] = l;
            } else {
              byte0 = ( (byte) (DLy[i2] >= l ? -1 : 1));
            }
            int j1 = i >> 1;
            for (int j2 = 0; ++DLx[i2] <= k && j2 < 3; j2++) {
              if ( (j1 -= j) < 0) {
                j1 += i;
                DLy[i2] += byte0;
              }
            }

          } else {
            byte byte1;
            if (DLy[i2] > l) {
              byte1 = ( (byte) (DLx[i2] <= k ? -1 : 1));
              int k1 = DLy[i2];
              DLy[i2] = l;
              l = k1;
              DLx[i2] = k;
            } else {
              byte1 = ( (byte) (DLx[i2] >= k ? -1 : 1));
            }
            int l1 = j >> 1;
            for (int k2 = 0; ++DLy[i2] <= l && k2 < 3; k2++) {
              if ( (l1 -= i) < 0) {
                l1 += j;
                DLx[i2] += byte1;
              }
            }

          }
          g.setColor(255, 255, 0);
          g.drawLine(DLx[i2], DLy[i2], DLxb[i2], DLyb[i2]);
          DLxb[i2] = DLx[i2];
          DLyb[i2] = DLy[i2];
          if (DLy[i2] < 125 || DLy[i2] >= 130 || DLx[i2] < Vxp ||
              DLx[i2] >= Vxp + Vs) {
            continue;
          }
          Scene = 25;
          g.setColor(255, 255, 255);
          Miss_Flag = true;
          Doh = 0;
          if (Vr > 0) {
            Vr--;
          }
          if (Vr == 0) {
            Scene = 30;
          }
          DLT = 0;
          break;
        }

        if (DLyb[0] == 130) {
          DLT = 0;
        }
      }
    }
  }

  public void drawBreak(Graphics g) {
    if (Brf != 0) {
      if (Brf == 1) {
        g.setColor(255, 0, 0);
        Brf = 2;
      } else
      if (Brf == 2) {
        g.setColor(0, 255, 0);
        Brf = 3;
      } else
      if (Brf == 3) {
        g.setColor(0, 0, 255);
        Brf = 1;
      }
      g.drawLine(105, 125, 105, 130);
    }
  }

  public void roundDataRead(int i) {
    try {
      byte abyte0[] = new byte[2];
      byte abyte1[] = new byte[2];
      int j = 0;
      DataInputStream datainputstream = null;
      DataInputStream datainputstream1 = null;
      int ai[] = {
          0x40403, 0x4050504, 0x4030301, 0x4040404, 0x1030404, 0x4040103,
          0x5030302, 0x6040404, 0x2010207, 0x4030404,
          0x5040403, 0x1041303, 0x4040603, 0x2030301, 0x9040705, 0x3040303,
          0x3040104, 0x6070505, 0x6040501, 0x5010707,
          0x2060506, 0x1040205, 0x1040504, 0x2070305, 0x1040101
      };
      int ai1[] = {
          0x2b3327, 0x3d21293f, 0x33161933, 0x3f492933, 0x2747544d, 0x31293329,
          0x3f402b1e, 0x482f3557, 0x1b332557, 0x52254a29,
          0x54425925, 0x333d472d, 0x402f5539, 0x2d423b33, 0x5b294943,
          0x2d513d51, 0x362b3319, 0x335e3949, 0x251c3f2d, 0x21335349,
          0x1d39413c, 0x25354739, 0x3337604b, 0x3551353f, 0x47223533
      };
      for (int l = 0; l < 8; l++) {
        for (int j1 = 0; j1 < 10; j1++) {
          Wd[j1 + l * 20] = 0x10000;
          Wd[j1 + l * 20 + 10] = 0x20000;
        }

      }

      datainputstream = new DataInputStream(Class.forName("Arkanoid").
                                            getResourceAsStream("wall.dat"));
      datainputstream1 = new DataInputStream(Class.forName("Arkanoid").
                                             getResourceAsStream("kind.dat"));
      int i1;
      for (i1 = 0; i1 < i / 4; i1++) {
        j += ai1[i1] >> 24 & 0xff;
        j += ai1[i1] >> 16 & 0xff;
        j += ai1[i1] >> 8 & 0xff;
        j += ai1[i1] & 0xff;
      }

      for (int k1 = 0; k1 < i % 4; k1++) {
        j += ai1[i1] >> 24 - k1 * 8 & 0xff;

      }
      datainputstream.skipBytes( (i - 1) * 20);
      datainputstream1.skipBytes(j);
      for (i1 = 0; i1 < 20; i1++) {
        datainputstream.read(abyte0, 0, 1);
        for (int l1 = 0; l1 < 8; l1++) {
          if ( (abyte0[0] >> 7 - l1 & 1) == 1) {
            datainputstream1.read(abyte1, 0, 1);
            Wd[i1 * 8 + l1] |= abyte1[0];
          }
        }

      }

      datainputstream.close();
      datainputstream1.close();
      j = 0;
      for (i1 = 0; i1 < i / 4; i1++) {
        j += ai[i1] >> 24 & 0xff;
        j += ai[i1] >> 16 & 0xff;
        j += ai[i1] >> 8 & 0xff;
        j += ai[i1] & 0xff;
      }

      for (int i2 = 0; i2 < i % 4; i2++) {
        j += ai[i1] >> 24 - i2 * 8 & 0xff;

      }
      datainputstream = new DataInputStream(Class.forName("Arkanoid").
                                            getResourceAsStream("item.dat"));
      datainputstream.skipBytes(j);
      i1 = 0;
      while ( (j = datainputstream.read(abyte0, 0, 1)) != -1) {
        int k = abyte0[0] & 0xff;
        if (k != 255) {
          for (Id[i1] = (k & 0xf0) >> 4; Id[i1] == 9;
               Id[i1] = Math.abs(Rnd.nextInt()) % 9) {
            ;
          }
          i1++;
          for (Id[i1] = k & 0xf; Id[i1] == 9;
               Id[i1] = Math.abs(Rnd.nextInt()) % 9) {
            ;
          }
          i1++;
          continue;
        }
        datainputstream.close();
        break;
      }
    } catch (Exception exception) {}
  }

⌨️ 快捷键说明

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