click space and then click the green flag until you catch the ghost.
I got this code from the book coder academy.