This has probably been done a billioN times
https://scratch.mit.edu/studios/35236113/comments/#comments-282072155