You should spend a couple of days doing all of the tutorials in the Help tab on the site. Check out the extras at the bottom left panel as well, the ones made by Abigayl (something like this). Follow it and look/experiment with the codes/blocks. Once you do that, you should be able to what you want easily. Another thing, for your 'stuck' problem, I would suggest you use rounded collision boxes and/or make the pixel movement using defined accurate lengths.
Example, if the height of the two paths going up and down are 100 pixels each and pacman starts at 0 pixels, make his movement shift by 10 so that you would always end at 0 or 100 instead of 1/99/101 which would cause pacman to be stuck.
For the ghosts, it's basically the same idea except now you have to create a feature of locating pacman and seeking him out using the best route.