Press the Green Flagie and a new maze will be generated, Up Arrow-Down Arrow Left Arrow-Right Arrow to move, try and make it to the Big Red X. Every time the Big Red X is reached, a new maze will spawn. There is a glitch where every second maze generation the pacman spite doesn't change where he's facing when you press the arrow keys, haven't fixed that yet, but maybe I will in the future.
I basically just copied everything from a really well made tutorial by griffpatch on YouTube but made it Pacman, he also has a scratch account so please go follow him if you don't already (He is very well known). Link to the video I used: https://www.youtube.com/watch?v=22Dpi5e9uz8&t=676s