Package com.mojang.ld22.item

Examples of com.mojang.ld22.item.Item


  }

  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


        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

  }

  public void heal(int heal) {
    if (hurtTime > 0) return;

    level.add(new TextParticle("" + heal, x, y, Color.get(-1, 50, 50, 50)));
    health += heal;
    if (health > maxHealth) health = maxHealth;
  }
View Full Code Here

      int yd = level.player.y - y;
      if (xd * xd + yd * yd < 80 * 80) {
        Sound.monsterHurt.play();
      }
    }
    level.add(new TextParticle("" + damage, x, y, Color.get(-1, 500, 500, 500)));
    health -= damage;
    if (attackDir == 0) yKnockback = +6;
    if (attackDir == 1) yKnockback = -6;
    if (attackDir == 2) xKnockback = -6;
    if (attackDir == 3) xKnockback = +6;
View Full Code Here

  }

  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

        }
      }
    }
    try {
      screen = new Screen(WIDTH, HEIGHT, new SpriteSheet(ImageIO.read(Game.class.getResourceAsStream("/icons.png"))));
      lightScreen = new Screen(WIDTH, HEIGHT, new SpriteSheet(ImageIO.read(Game.class.getResourceAsStream("/icons.png"))));
    } catch (IOException e) {
      e.printStackTrace();
    }

    resetGame();
View Full Code Here

        }
      }
    }
    try {
      screen = new Screen(WIDTH, HEIGHT, new SpriteSheet(ImageIO.read(Game.class.getResourceAsStream("/icons.png"))));
      lightScreen = new Screen(WIDTH, HEIGHT, new SpriteSheet(ImageIO.read(Game.class.getResourceAsStream("/icons.png"))));
    } catch (IOException e) {
      e.printStackTrace();
    }

    resetGame();
View Full Code Here

public class FurnitureRecipe extends Recipe {
  private Class<? extends Furniture> clazz;

  public FurnitureRecipe(Class<? extends Furniture> clazz) throws InstantiationException, IllegalAccessException {
    super(new FurnitureItem(clazz.newInstance()));
    this.clazz = clazz;
  }
View Full Code Here

    this.clazz = clazz;
  }

  public void craft(Player player) {
    try {
      player.inventory.add(0, new FurnitureItem(clazz.newInstance()));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

  public void tick() {
    if (shouldTake != null) {
      if (shouldTake.activeItem instanceof PowerGloveItem) {
        remove();
        shouldTake.inventory.add(0, shouldTake.activeItem);
        shouldTake.activeItem = new FurnitureItem(this);
      }
      shouldTake = null;
    }
    if (pushDir == 0) move(0, +1);
    if (pushDir == 1) move(0, -1);
View Full Code Here

TOP

Related Classes of com.mojang.ld22.item.Item

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.