Everything explained inside the project, so just click see inside, I ran out of characters to write everything here lol. There is a more accurate way of doing this, but it has more limitations than this one
100% by me Use with credit Check this project out by @Veselje it gives more accurate results: https://scratch.mit.edu/projects/1253324373/