public void animation(Canvas canvas) {
        update();
        //Buffer strategy
        if (canvas.getBufferStrategy()==null) {
            canvas.createBufferStrategy(3);
        }

        draw(canvas.getBufferStrategy().getDrawGraphics());
        canvas.getBufferStrategy().show();

    }