It`s a long process involving a lot of work. Try looking at the example projects with scratch, or downloading scratch games you like the look of and looking through the scripts they use.
Try my latest game, Rolling 2, a 10-level platform game based around the gravity marble.