Package raiding.engine.model

Source Code of raiding.engine.model.PlayerAvatar

package raiding.engine.model;

import org.newdawn.slick.Animation;
import org.newdawn.slick.geom.Vector2f;

public class PlayerAvatar {
  private Vector2f position;
  private Animation avatar;
 
  private final int width = 60;
  private final int height = 60;
 
  public PlayerAvatar(Animation avatar, int xPos, int yPos) {
    this.position = new Vector2f(xPos, yPos);
    this.avatar = avatar;
  }
 
  public void draw() {
    avatar.draw(getFeetPosition().x, getFeetPosition().y);
  }

  public Animation getAvatar() {
    return avatar;
  }

  public void setPosition(Vector2f position) {
    this.position = position;
  }

  public Vector2f getPosition() {
    return position;
  }
 
  public Vector2f getFeetPosition() {
    float feetx = position.x - (width /2);
    float feety = position.y - height;
    return(new Vector2f(feetx, feety));
  }
}
TOP

Related Classes of raiding.engine.model.PlayerAvatar

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.