A simple example in response to this question from @bunnyCoder16: https://scratch.mit.edu/projects/563311030/#comments-224158975 All code by me (@kriblo). Inside there's a separate sprite with the same code, but with comments.