Section 2How Your First Program Works

How Programs Are Structured 19Method Main () 21Using Sprites to Display Graphics for Games 22Coordinate System 24Media Files 27Exercise: Understanding Locations on the Screen 29

How Programs Are Structured

In Section 1, you typed in and ran your first program—way to go! From now on, our job with this short cut is to explain it all to you so that you understand how and why your program works the way it does, and how you can start creating your own programs. Of course, by the end of this short cut, you will have created a complete game of your own, not just the simple example shown in Figure 2.1.

Figure 2.1 Your first Phrogram program

Let's note a few key things about how the instructions (or code) are presented ...

Get Learn to Program with Phrogram™!: A Guide to Learning Through Game Programming Using the Latest Version of Kids Programming Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.