public void keyPressed(KeyEvent w) {
        int code = w.getKeyCode();
        if (code == KeyEvent.VK_A) {
            left = true;
            right = false;
            dx = -SPEED;
        } else if (code == KeyEvent.VK_D) {
            right = true;
            left = false;
            dx = SPEED;
        } else if (code == KeyEvent.VK_W) {
            up = true;
            down = false;
            dy = -SPEED;
        } else if (code == KeyEvent.VK_S) {
            down = true;
            up = false;
            dy = SPEED;
        }

    }