package fr.monkhanny.dorfromantik.listeners;

import fr.monkhanny.dorfromantik.game.Board;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class GameArrowKeyListener extends KeyAdapter {
    private Board board;

    public GameArrowKeyListener(Board board) {
        this.board = board;
    }

    @Override
    public void keyPressed(KeyEvent e) {
        switch (e.getKeyCode()) {
            case KeyEvent.VK_UP:
                board.moveBoard(0, -10); // Déplacer vers le haut
                break;
            case KeyEvent.VK_DOWN:
                board.moveBoard(0, 10); // Déplacer vers le bas
                break;
            case KeyEvent.VK_LEFT:
                board.moveBoard(-10, 0); // Déplacer vers la gauche
                break;
            case KeyEvent.VK_RIGHT:
                board.moveBoard(10, 0); // Déplacer vers la droite
                break;
        }
    }
}
