Package com.mojang.ld22.entity

Examples of com.mojang.ld22.entity.Player


        }
      }
    }
    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

    this.input = input;
    x = 24;
    y = 24;
    stamina = maxStamina;

    inventory.add(new FurnitureItem(new Workbench()));
    inventory.add(new PowerGloveItem());
  }
View Full Code Here

    return this;
  }

  public void checkCanCraft(Player player) {
    for (int i = 0; i < costs.size(); i++) {
      Item item = costs.get(i);
      if (item instanceof ResourceItem) {
        ResourceItem ri = (ResourceItem) item;
        if (!player.inventory.hasResources(ri.resource, ri.count)) {
          canCraft = false;
          return;
View Full Code Here

  public abstract void craft(Player player);

  public void deductCost(Player player) {
    for (int i = 0; i < costs.size(); i++) {
      Item item = costs.get(i);
      if (item instanceof ResourceItem) {
        ResourceItem ri = (ResourceItem) item;
        player.inventory.removeResource(ri.resource, ri.count);
      }
    }
View Full Code Here

      screen.render(xo, 2 * 8, recipe.resultTemplate.getSprite(), recipe.resultTemplate.getColor(), 0);
      Font.draw("" + hasResultItems, screen, xo + 8, 2 * 8, Color.get(-1, 555, 555, 555));

      List<Item> costs = recipe.costs;
      for (int i = 0; i < costs.size(); i++) {
        Item item = costs.get(i);
        int yo = (5 + i) * 8;
        screen.render(xo, yo, item.getSprite(), item.getColor(), 0);
        int requiredAmt = 1;
        if (item instanceof ResourceItem) {
          requiredAmt = ((ResourceItem) item).count;
        }
        int has = player.inventory.count(item);
View Full Code Here

    if (len == 0) selected = 0;
    if (selected < 0) selected += len;
    if (selected >= len) selected -= len;

    if (input.attack.clicked && len > 0) {
      Item item = player.inventory.items.remove(selected);
      player.activeItem = item;
      game.setMenu(null);
    }
  }
View Full Code Here

    x = 24;
    y = 24;
    stamina = maxStamina;

    inventory.add(new FurnitureItem(new Workbench()));
    inventory.add(new PowerGloveItem());
  }
View Full Code Here

TOP

Related Classes of com.mojang.ld22.entity.Player

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.