Class SnakePlayer

All Implemented Interfaces:
KeyListener, EventListener

public class SnakePlayer extends Snake implements KeyListener
Snake which can be move by player.
  • Constructor Details

    • SnakePlayer

      public SnakePlayer(Board board)
      Pass the reference to board.
  • Method Details

    • control

      protected void control()
      Description copied from class: Snake
      Control of snake depending if it's player od AI
      Overrides:
      control in class Snake
    • dead

      protected void dead()
      Description copied from class: Snake
      Destroy all snake's parts and destroy snake.
      Overrides:
      dead in class Snake
    • awake

      protected void awake()
      Description copied from class: GameObject
      Like unity Awake (invoke on create of object or create gameplay).
      Overrides:
      awake in class Snake
    • keyTyped

      public void keyTyped(KeyEvent e)
      Specified by:
      keyTyped in interface KeyListener
    • keyPressed

      public void keyPressed(KeyEvent e)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent e)
      Specified by:
      keyReleased in interface KeyListener
    • 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