Class Fruit


public class Fruit extends GameObject
Static GameObject which grants points to Snake after collision.
  • Field Details

    • type

      public FruitType type
  • Constructor Details

    • Fruit

      public Fruit(Cell parentCell, FruitType type, FruitGenerator fruitGenerator)
      Costructor that set position and type of object. Pass reference to fruit generator,
  • Method Details

    • render

      protected void render(Graphics2D g)
      Description copied from class: GameObject
      Method who render a object on screen (invoke on begin of each frames).
      Overrides:
      render in class GameObject
    • onDestroy

      protected void onDestroy()
      Description copied from class: GameObject
      Like unity OnDestroy (invoke after destroy object or on end of game).
      Overrides:
      onDestroy in class GameObject