It's something I struggled with at first as well.
Did you read the section in the manual about how Events work? That might be the best place to start.
I'm not exactly sure what you are asking in your example, can you be a little more clear there? What part of the snake clone are you not getting in terms of the UI?