Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A computer program—including a video game—must do three things, and always only three things. We’ll call them the three rules of programming:
1. Get input.
2. Think about it.
3. Print output.
Even a video game works by following these three important rules. The thing is, a video game doesn’t have to print with a string or message. That item #3 can be changed to mean “Draw output.” The important thing is, something comes out of the program. In a video game, we will want to draw shapes, like players, monsters, trees, houses, and things like that.
Can you think of what the input for a video game might be for step #1?
I’ll let you think about it for a minute….
Ready with your answer?
Okay, I’m sure you got it right, but just to check, the answer is: input from a keyboard, mouse, or a controller.