Package gameobjects

Class TextObject


public class TextObject extends GameObject
Convenience Class subclassing GameObject, directly instanciating TextArtist a subclass of Artist that draws a text. The controller is left undefined, the collider as well. However, a single call to the overwritten method generateColliders() will in fact generate a RectCollider of just the right size for the text.
  • Constructor Details

    • TextObject

      public TextObject(String id, Playground playground, double x, double y, double vx, double vy, String text, int size, Color textColor)
      Constructor.
      Parameters:
      id - object name
      playground - containing Playground instance
      x - positionx
      y - positiony
      vx - speedx
      vy - speedy
      size - font size in Pixel
      text - String to be displayed
      textColor - text color, see java.awt.Color
  • Method Details

    • getText

      public String getText()
    • setText

      public void setText(String s)
    • generateColliders

      public TextObject generateColliders()
      Description copied from class: GameObject
      generates and sets collider(s) for this GameObject. This implementation does nothing. Intended to be overridden by subclasses.
      Overrides:
      generateColliders in class GameObject
      Returns:
      instance of this GameObject (this).