Package com.mojang.ld22.entity

Examples of com.mojang.ld22.entity.Player


    if (item instanceof ToolItem) {
      ToolItem tool = (ToolItem) item;
      if (tool.type == ToolType.shovel) {
        if (player.payStamina(4 - tool.level)) {
          level.setTile(xt, yt, Tile.dirt, 0);
          level.add(new ItemEntity(new ResourceItem(Resource.sand), xt * 16 + random.nextInt(10) + 3, yt * 16 + random.nextInt(10) + 3));
          return true;
        }
      }
    }
    return false;
View Full Code Here


    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));
      }
      count = random.nextInt(2);
      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(Resource.coal), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
      }
      level.setTile(x, y, Tile.dirt, 0);
    } else {
      level.setData(x, y, damage);
    }
View Full Code Here

        count += 2;
      } else {
        level.setData(x, y, damage);
      }
      for (int i = 0; i < count; i++) {
        level.add(new ItemEntity(new ResourceItem(toDrop), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
      }
    }
  }
View Full Code Here

      if (tool.type == ToolType.shovel) {
        if (player.payStamina(5)) {
          // level.setTile(xt, yt, Tile.infiniteFall, 0);
          int count = random.nextInt(2) + 1;
          for (int i = 0; i < count; i++) {
            level.add(new ItemEntity(new ResourceItem(Resource.cloud), xt * 16 + random.nextInt(10) + 3, yt * 16 + random.nextInt(10) + 3));
          }
          return true;
        }
      }
    }
View Full Code Here

public class ToolRecipe extends Recipe {
  private ToolType type;
  private int level;

  public ToolRecipe(ToolType type, int level) {
    super(new ToolItem(type, level));
    this.type = type;
    this.level = level;
  }
View Full Code Here

    this.type = type;
    this.level = level;
  }

  public void craft(Player player) {
    player.inventory.add(0, new ToolItem(type, level));
  }
View Full Code Here

    if (age < 50) level.setData(xt, yt, age + 1);
  }

  public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
    if (item instanceof ToolItem) {
      ToolItem tool = (ToolItem) item;
      if (tool.type == ToolType.shovel) {
        if (player.payStamina(4 - tool.level)) {
          level.setTile(xt, yt, Tile.dirt, 0);
          return true;
        }
View Full Code Here

    }
  }

  public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
    if (item instanceof ToolItem) {
      ToolItem tool = (ToolItem) item;
      if (tool.type == ToolType.shovel) {
        if (player.payStamina(4 - tool.level)) {
          level.setTile(xt, yt, Tile.dirt, 0);
          Sound.monsterHurt.play();
          if (random.nextInt(5) == 0) {
View Full Code Here

    hurt(level, x, y, dmg);
  }

  public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
    if (item instanceof ToolItem) {
      ToolItem tool = (ToolItem) item;
      if (tool.type == ToolType.pickaxe) {
        if (player.payStamina(4 - tool.level)) {
          hurt(level, xt, yt, random.nextInt(10) + (tool.level) * 5 + 10);
          return true;
        }
View Full Code Here

    screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0);
  }

  public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
    if (item instanceof ToolItem) {
      ToolItem tool = (ToolItem) item;
      if (tool.type == ToolType.shovel) {
        if (player.payStamina(4 - tool.level)) {
          level.setTile(xt, yt, Tile.hole, 0);
          level.add(new ItemEntity(new ResourceItem(Resource.dirt), xt * 16 + random.nextInt(10) + 3, yt * 16 + random.nextInt(10) + 3));
          Sound.monsterHurt.play();
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.