Beispiel #1
0
  public void bump(int x, int y, boolean canBreakBricks) {
    byte block = level.getBlock(x, y);

    if ((Level.TILE_BEHAVIORS[block & 0xff] & Level.BIT_BUMPABLE) > 0) {
      bumpInto(x, y - 1);
      level.setBlock(x, y, (byte) 4);
      // level.setBlockData(x, y, (byte) 4);

      if (((Level.TILE_BEHAVIORS[block & 0xff]) & Level.BIT_SPECIAL) > 0) {
        if (!mario.large) {
          addSprite(new Mushroom(this, x * 16 + 8, y * 16 + 8));
        } else {
          addSprite(new FireFlower(this, x * 16 + 8, y * 16 + 8));
        }
      } else {
        mario.getCoin();
        coinsCollected++;
        // addSprite(new CoinAnim(x, y));
      }
    }

    if ((Level.TILE_BEHAVIORS[block & 0xff] & Level.BIT_BREAKABLE) > 0) {
      bumpInto(x, y - 1);
      if (canBreakBricks) {
        level.setBlock(x, y, (byte) 0);
      } else {
        // level.setBlockData(x, y, (byte) 4);
      }
    }
  }
  public void getMushroom() {
    if (deathTime > 0 || world.paused) return;

    if (!large) {
      world.paused = true;
      powerUpTime = 3 * FractionalPowerUpTime;
      world.mario.setLarge(true, false);
      world.powerUpsCollected++;
    } else {
      getCoin();
    }
  }
Beispiel #3
0
  public void bumpInto(int x, int y) {
    byte block = level.getBlock(x, y);
    if (((Level.TILE_BEHAVIORS[block & 0xff]) & Level.BIT_PICKUPABLE) > 0) {
      mario.getCoin();
      coinsCollected++;
      level.setBlock(x, y, (byte) 0);
    }

    for (Sprite sprite : sprites) {
      sprite.bumpCheck(x, y);
    }
  }
  private boolean isBlocking(float _x, float _y, float xa, float ya) {
    int x = (int) (_x / 16);
    int y = (int) (_y / 16);
    if (x == (int) (this.x / 16) && y == (int) (this.y / 16)) return false;

    boolean blocking = world.level.isBlocking(x, y, xa, ya);

    byte block = world.level.getBlock(x, y);

    if (((Level.TILE_BEHAVIORS[block & 0xff]) & Level.BIT_PICKUPABLE) > 0) {
      getCoin();
      world.level.setBlock(x, y, (byte) 0);
    }

    if (blocking && ya < 0) {
      world.bump(x, y, large);
      if (world.verbose > 0) System.out.println("Sim Mario bumps a crate!");
    }
    // System.out.println("Sim Mario blockcheck: pos: " + _x + " "+_y + " discrete: "+x + " "+y+
    //		" block: "+block+" blocking?: " + (blocking? "true":"false") + "behaviourvalue: "
    //		+ ((Level.TILE_BEHAVIORS[block & 0xff]) & Level.BIT_PICKUPABLE));
    return blocking;
  }