Class SnakePlayer
java.lang.Object
GameObject
Snake
SnakePlayer
- All Implemented Interfaces:
KeyListener
,EventListener
Snake which can be move by player.
-
Field Summary
Fields inherited from class Snake
board, body, color, direction, newPartsNumber, points, TIMER_BASE_VALUE
Fields inherited from class GameObject
game, timer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
awake()
Like unity Awake (invoke on create of object or create gameplay).protected void
control()
Control of snake depending if it's player od AIprotected void
dead()
Destroy all snake's parts and destroy snake.void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
protected void
render(Graphics2D g)
Method who render a object on screen (invoke on begin of each frames).Methods inherited from class Snake
Head, ModeLeft, MoveDown, MoveRight, MoveUp, onDestroy, start, update
Methods inherited from class GameObject
getDeltaTime, setTimer, timerClockDown
-
Constructor Details
-
SnakePlayer
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 -
dead
protected void dead()Description copied from class:Snake
Destroy all snake's parts and destroy snake. -
awake
protected void awake()Description copied from class:GameObject
Like unity Awake (invoke on create of object or create gameplay). -
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
-
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
-
render
Description copied from class:GameObject
Method who render a object on screen (invoke on begin of each frames).- Overrides:
render
in classGameObject
-