There are multiple ways of doing this, id say it depends on what you are specifically after and how the rest of your game works.
Here's another way: open C2, click start a new project, scroll down and choose Template: Auto-runner. See if you like how it's done there.