Interface Actor


public interface Actor
By implementing the Actor interface and adding an instance of such a class to a World will make the simulation call the act method during each step of the simulation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    act(World world)
    The method called whenever the actor needs to simulate actions.
  • Method Details

    • act

      void act(World world)
      The method called whenever the actor needs to simulate actions. The worlds 'current location' is only set at the time when the method is called. Thus, if you use setTile, remove, or delete, the current position does not automatically update. This has multiple implications, e.g., if you want to use World.getSurroundingTiles() after using World.setTile(itumulator.world.Location, java.lang.Object) within the act method, the program will throw an exception. This can be circumvented by updating the current location (World.setCurrentLocation(itumulator.world.Location)) or exclusively using the World methods which accepts a location parameter (by the same name).
      Parameters:
      world - providing details of the position on which the actor is currently located and much more.