public void keyPressed(KeyEvent w) {
        int code = w.getKeyCode();
        if (code == KeyEvent.VK_A) {
            i=0;
            dx = -SPEED;
        } else if (code == KeyEvent.VK_D) {
            i=1;
            dx = SPEED;
        } else if (code == KeyEvent.VK_W) {
            dy = -SPEED;
        } else if (code == KeyEvent.VK_S) {
            dy = SPEED;
        }

    }