示例#1
0
  /**
   * Creates an instace of the player from an actorDescription.
   *
   * @param game instance of the game running
   * @param desc the ActorDescription
   * @param position the position in screenspace
   * @param controllerActive indicates if the player should be controlled by the keyboard
   * @param actID the actorID to be given. This is only done in network-games
   */
  public Player(
      Game game, ActorDescription desc, Vector2 position, boolean controllerActive, int actID) {
    super(game, desc, position);

    this.actorID = actID;

    this.state = DynamicObjectState.Idle;
    this.velocity = new Vector2(0, 0);
    this.game = game;

    controller = game.getController();
    statsMenu = new StatsMenu(stats, controller, this);
    statusbar = new StatusBar(this, game);
    inventory.setGold(25);

    // TEST
    spellManager = new SpellManager(this);
    spellManager.addShields();

    initAnimations();

    // DEBUG
    skillTree = new SkillTree(this, controller, collision);
    buildSpell();
    this.controllerActive = controllerActive;
    controlled = controllerActive;
    isInNetwork = game.isInNetwork();
    posState = new PositionState(this);
  }
示例#2
0
 @Override
 public void levelUp() {
   health.fillHealth();
   mana.fillMana();
   statsMenu.leveledUp();
   spellManager.addShields();
 }
示例#3
0
 /** Updates MaxHealth and MaxMana after a change in stats. */
 public void renewHealthMana() {
   health.setMaxHealh(stats.getStamina() * Stats.HEALTH_PER_STAM);
   mana.setMaxMana(stats.getWill() * Stats.MANA_PER_WILL);
   spellManager.addShields();
 }