name all of your files pygame.py Flashcards

1
Q

What are the basic steps of formatting a pygame program?

A
  1. Import pygame
  2. Initialize pygame
  3. Set up the screen
  4. Create the game loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What function initializes pygame?

A

pygame.init()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What function creates the GUI of pygame?

A

pygame.display.set_mode((width, length), flags, depth)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What type of loop is usually used in pygame?

A

While loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are colors stored as?

A

RGB tuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the range of values possible for RGB tuples?

A

0-255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the possible shapes you can draw using pygame?

A

Polygon, line, circle, ellipse, and a rectangle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What function creates a polygon?

A

pygame.draw.polygon(surface, color, (coordinates of vertices), width)

Width is optional but default is 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What function creates a line?

A

pygame.draw.line(surface, color, (start), (end), width)

Width default is 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What function creates a circle?

A

pygame.draw.circle(surface, color, (center), radius, width)

Width is optional but default is 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What function creates an ellipse?

A

pygame.draw.ellipse(surface, color, (x, y, width, height), width)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What function creates a rectangle?

A

pygame.draw.rect(surface, color, (x, y, width, height), width)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What do the x and y values dictate in pygame.draw.ellipse and pygame.draw.rect?

A

They are the coordinate points of the top left vertex. The width is how much the shape travels left, and the height is how much the shape travels down.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do the last width values in ellipses and rectangles differ from the width values in polygons, lines, and circles?

A

The last width values of ellipses and rectangles refer to its line width only. When it is 0, it fills the shape.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the basic steps of formatting text?

A
  1. Set up the font
  2. Set up the text
  3. Set the location
  4. Write onto the screen
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What function creates a font?

A

basicFont = pygame.font.SysFont(font name, size)

17
Q

What function creates a text object?

A

text = basicFont.render(“string”, True, text color, BG color)

18
Q

What functions establishes the location of a text object?

A

textRect = text.get_rect()
textRect.centerx = number
textRect.centery = number

19
Q

What function actually makes the text appear onscreen?

A

surface.blit(text, textRect)