Name:     ID: 
 
Email: 

Python Game Programming Final

Completion
Complete each statement.
 

 1. 

Python programs can be text based and let the user type in text from the keyboard. This type of program has a _____________________ or CLI.
 

 

 2. 

Pygame provides functions for creating programs with a ___________________ or GUI to show a window with images and colors.
 

 

 3. 

To run a program from IDLE select ________ then ______________ from the menu. (enter sach blank with a comma between)
 

 

 4. 

You can run a program in IDLE with one key press, that key is _____.
 

 

 5. 

Every program in pygame will start with the following line of code: ___________________________.
 

 

 6. 

When you call an import that end in an asterisk, for example, from pygame.locals import *, the asterisk stands for ____________.
 

 

 7. 

The _____________function call, which always needs to be called after importing the pygame module and before calling any other Pygame function. You don’t need to know what this function does, you just need to know that it needs to be called first in order for many Pygame functions to work. If you ever see an error message like pygame.error: font not initialized, check to see if you forgot to call _____________ at the start of your program. (both blanks are the same answer, only enter it once)
 

 

 8. 

DISPLAYSURF = pygame.display.set_mode((400, 300))
In the above code, the 400 represents the __________ of the window.
 

 

 9. 

A _________________ is a loop where the code does three things:
1. Handles events.
2. Updates the game state.
3. Draws the game state to the screen.
 

 

 10. 

The main loop also has code that updates the game state based on which events have been created. This is usually called _______________.
 

 

 11. 

The window that the program creates is just composed of little square dots on your screen called ___________.
 

 

 12. 

A _________________ is the same thing as a normal function call, except that its return value is a new object.
 

 

 13. 

Tuples of three integers used to represent a color are often called _______ values.
 

 

 14. 

You can mimic the effect of transparency by adding a fourth 0 to 255 integer value to your color values. This value is known as the _______ value.
 

 

 15. 

Pygame provides several different functions for drawing different shapes onto a surface object. These shapes such as rectangles, circles, ellipses, lines, or individual pixels are often called _______________.
 

 

 16. 

The _________ method is not a function but a method of pygame.Surface objects. It will completely fill in the entire Surface object with whatever color value you pass as for the color parameter.
 

 

 17. 

The frame rate or refresh rate is the number of pictures that the program draws per second, and is measured in _________________.
 

 

 18. 

_____________ is a graphics technique for making text and shapes look less blocky by adding a little bit of blur to their edges.
 

 

 19. 

A list of lists of lists of values would be a 3D list. Another word for two or more dimensional lists is a ____________________ list.
 

 

 20. 

Enter comments in Python with a leading _____.
 

 

Matching
 
 
Match the following functions to the correct descriptions:
a.
pygame.draw.line(surface, color, start_point, end_point, width)
b.
pygame.draw.lines(surface, color, closed, pointlist, width)
c.
pygame.draw.circle(surface, color, center_point, radius, width)
d.
pygame.draw.ellipse(surface, color, bounding_rectangle, width)
e.
pygame.draw.rect(surface, color, rectangle_tuple, width)
 

 21. 

This function draws a circle. The center of the circle is at the center_point parameter. The integer passed for the radius parameter sets the size of the circle.
The radius of a circle is the distance from the center to the edge. (The radius of a circle is always half of the diameter.) Passing 20 for the radius parameter will draw a circle that has a radius of 20 pixels.
 

 22. 

This function draws a line between the start_point and end_point parameters.
 

 23. 

This function draws a rectangle. The rectangle_tuple is either a tuple of four integers (for the XY coordinates of the top left corner, and the width and height) or a pygame.Rect object can be passed instead. If the rectangle_tuple has the same size for the width and height, a square will be drawn.
 

 24. 

This function draws a series of lines from one point to the next, much like pygame.draw.polygon(). The only difference is that if you pass False for the closed parameter, there will not be a line from the last point in the pointlist parameter to the first point. If you pass True, then it will draw a line from the last point to the first.
 

 25. 

This function draws an ellipse (which is like a squashed or stretched circle). This function has all the usual parameters, but in order to tell the function how large and where to draw the ellipse, you must specify the bounding rectangle of the ellipse. A bounding rectangle is the smallest rectangle that can be drawn around a shape. The bounding_rectangle parameter can be a pygame.Rect object or a tuple of four integers. Note that you do not specify the center point for the ellipse like you do for the pygame.draw.circle() function.
 



 
         Start Over