All Implemented Interfaces:
Tile

public class Hero extends Actor
A class that represents the hero/player in the game.
  • Field Summary

    Fields inherited from class nz.ac.vuw.ecs.swen225.gp6.domain.TileAnatomy.AbstractTile

    info
  • Constructor Summary

    Constructors
    Constructor
    Description
    Hero(TileInfo info)
    Create a Hero actor.
  • Method Summary

    Modifier and Type
    Method
    Description
    dir()
    gets the direction the hero is facing.
    void
    Calculates the next state of the tile in the domain(maze/inventory).
    when an actor is moved onto this tile, then is to move off of it, replace it with the tile that this method returns.
    void
    setOn(Tile t, Domain d)
    Sets the given tile t instead of this tile on maze, changing the domain to do so.
    void
    This is at the moment only for testing purposes, MUST NOT be used in game.
    Each tile object will hold a reference to one TileState enum, which determines the behaviour of a number of the tiles important methods.

    Methods inherited from class nz.ac.vuw.ecs.swen225.gp6.domain.TileGroups.Actor

    tileOn

    Methods inherited from class nz.ac.vuw.ecs.swen225.gp6.domain.TileAnatomy.AbstractTile

    info, symbol

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface nz.ac.vuw.ecs.swen225.gp6.domain.TileAnatomy.Tile

    damagesHero, obstructsEnemy, obstructsHero
  • Constructor Details

    • Hero

      public Hero(TileInfo info)
      Create a Hero actor.
      Parameters:
      info - tile information
  • Method Details

    • type

      public TileType type()
      Description copied from interface: Tile
      Each tile object will hold a reference to one TileState enum, which determines the behaviour of a number of the tiles important methods.
      Returns:
      the enum type of this tile, if custom tile then TileType.Other is returned.
    • setTileOn

      public void setTileOn(Tile t)
      This is at the moment only for testing purposes, MUST NOT be used in game.
      Parameters:
      t - sets the tile the hero will replace when moved
    • dir

      public Direction dir()
      gets the direction the hero is facing.
      Returns:
      direction that hero is facing (not necessarily will move to)
    • replaceWith

      public Tile replaceWith()
      Description copied from interface: Tile
      when an actor is moved onto this tile, then is to move off of it, replace it with the tile that this method returns.
      Returns:
      tile that is to replace this tile after an actor going over it. If not implemented, defaults to Floor.
    • setOn

      public void setOn(Tile t, Domain d)
      Description copied from interface: Tile

      Sets the given tile t instead of this tile on maze, changing the domain to do so. NOTE1: may alter domain. NOTE2: does not check wether it's possible for tile t to move on this tile(thoroughly)! Although often it has a set of exceptions that will be thrown if a completely unexpected input is given.

      if not implemented defaults to replacing this tile with given tile on maze.

      Parameters:
      t - tile to replace this tile with, can not be null.
      d - domain where this change is happening, can not be null.
    • ping

      public void ping(Domain d)
      Description copied from interface: Tile
      Calculates the next state of the tile in the domain(maze/inventory). Based on the tile and domain state, this method may alter the state of the tile and given domain object. NOTE: may alter domain.
      Parameters:
      d - domain object, (maze/inventory), where this change is happening.