Class GraphicsEntity

java.lang.Object
ch.epfl.cs107.play.engine.actor.Entity
ch.epfl.cs107.play.engine.actor.GraphicsEntity
All Implemented Interfaces:
Acoustics, Actor, Graphics, Updatable, Positionable

public class GraphicsEntity extends Entity
GraphicEntity useful to link a single Specific Graphic type to a space point
  • Constructor Details

    • GraphicsEntity

      public GraphicsEntity(Vector position, ImageGraphics graphics)
      Alternative GraphicsEntity Constructor
      Parameters:
      position - (Vector): initial Position. Not null
      graphics - (ImageGraphics): graphics to display at position. Not null
    • GraphicsEntity

      public GraphicsEntity(Vector position, TextGraphics graphics)
      Alternative GraphicsEntity Constructor
      Parameters:
      position - (Vector): initial Position. Not null
      graphics - (TextGraphics): graphics to display at position. Not null
    • GraphicsEntity

      public GraphicsEntity(Vector position, ShapeGraphics graphics)
      Alternative GraphicsEntity Constructor
      Parameters:
      position - (Vector): initial Position. Not null
      graphics - (ShapeGraphics): graphics to display at position. Not null
  • Method Details

    • getGraphics

      public Graphics getGraphics()
      Returns:
      (Graphics): The graphics of the entity
    • setCurrentPosition

      public void setCurrentPosition(Vector position)
      Set the current position. Make public the protected method of super class
      Overrides:
      setCurrentPosition in class Entity
      Parameters:
      position - (Vector): new Position. Not null
    • draw

      public void draw(Canvas canvas)
      Description copied from interface: Graphics
      Renders itself on specified canvas.
      Parameters:
      canvas - target, not null