Package com.mojang.escape.entities

Source Code of com.mojang.escape.entities.KeyEntity

package com.mojang.escape.entities;

import com.mojang.escape.*;
import com.mojang.escape.gui.Sprite;

public class KeyEntity extends Entity {
  public static final int COLOR = Art.getCol(0x00ffff);
  private Sprite sprite;
  private double y, ya;

  public KeyEntity(double x, double z) {
    this.x = x;
    this.z = z;
    y = 0.5;
    ya = 0.025;
    sprite = new Sprite(0, 0, 0, 16 + 3, COLOR);
    sprites.add(sprite);
  }

  public void tick() {
    move();
    y += ya;
    if (y < 0) y = 0;
    ya -= 0.005;
    sprite.y = y;
  }

  protected void collide(Entity entity) {
    if (entity instanceof Player) {
      Sound.key.play();
      ((Player) entity).keys++;
      remove();
    }
  }
}
TOP

Related Classes of com.mojang.escape.entities.KeyEntity

TOP
Copyright © 2018 www.massapi.com. 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.