Package com.mojang.ld22.level

Examples of com.mojang.ld22.level.Level


    entitiesInTiles[x + y * w].remove(e);
  }

  public void trySpawn(int count) {
    for (int i = 0; i < count; i++) {
      Mob mob;

      int minLevel = 1;
      int maxLevel = 1;
      if (depth < 0) {
        maxLevel = (-depth) + 1;
      }
      if (depth > 0) {
        minLevel = maxLevel = 4;
      }

      int lvl = random.nextInt(maxLevel - minLevel + 1) + minLevel;
      if (random.nextInt(2) == 0)
        mob = new Slime(lvl);
      else
        mob = new Zombie(lvl);

      if (mob.findStartPos(this)) {
        this.add(mob);
      }
    }
  }
View Full Code Here


    levels[2] = new Level(128, 128, -1, levels[3]);
    levels[1] = new Level(128, 128, -2, levels[2]);
    levels[0] = new Level(128, 128, -3, levels[1]);

    level = levels[currentLevel];
    player = new Player(this, input);
    player.findStartPos(level);

    level.add(player);

    for (int i = 0; i < 5; i++) {
View Full Code Here

        minLevel = maxLevel = 4;
      }

      int lvl = random.nextInt(maxLevel - minLevel + 1) + minLevel;
      if (random.nextInt(2) == 0)
        mob = new Slime(lvl);
      else
        mob = new Zombie(lvl);

      if (mob.findStartPos(this)) {
        this.add(mob);
View Full Code Here

      int lvl = random.nextInt(maxLevel - minLevel + 1) + minLevel;
      if (random.nextInt(2) == 0)
        mob = new Slime(lvl);
      else
        mob = new Zombie(lvl);

      if (mob.findStartPos(this)) {
        this.add(mob);
      }
    }
View Full Code Here

    return false;
  }

  public void hurt(Level level, int x, int y, int dmg) {
    int damage = level.getData(x, y) + dmg;
    level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
    level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
    if (damage >= 50) {
      int count = random.nextInt(4) + 1;
      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(Resource.stone), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
View Full Code Here

    return false;
  }

  public void hurt(Level level, int x, int y, Mob source, int dmg, int attackDir) {
    int damage = level.getData(x, y) + dmg;
    level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
    level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
    if (damage >= 10) {
      int count = random.nextInt(2) + 1;
      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(Resource.cactusFlower), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
View Full Code Here

      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(Resource.apple), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
      }
    }
    int damage = level.getData(x, y) + dmg;
    level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
    level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
    if (damage >= 20) {
      int count = random.nextInt(2) + 1;
      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(Resource.wood), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
View Full Code Here

    return false;
  }

  public void hurt(Level level, int x, int y, int dmg) {
    int damage = level.getData(x, y) + dmg;
    level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
    level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
    if (damage >= 200) {
      int count = random.nextInt(4) + 1;
      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(Resource.stone), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
View Full Code Here

    return false;
  }

  public void hurt(Level level, int x, int y, int dmg) {
    int damage = level.getData(x, y) + 1;
    level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
    level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
    if (dmg > 0) {
      int count = random.nextInt(2);
      if (damage >= random.nextInt(10) + 3) {
        level.setTile(x, y, Tile.dirt, 0);
View Full Code Here

    return false;
  }

  public void hurt(Level level, int x, int y, int dmg) {
    int damage = level.getData(x, y) + 1;
    level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
    level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
    if (dmg > 0) {
      if (damage >= 10) {
        level.setTile(x, y, Tile.cloud, 0);
      } else {
View Full Code Here

TOP

Related Classes of com.mojang.ld22.level.Level

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.