Pygame Flashcards
parameters
(red, green, blue)
WHITE
(255, 255, 255)
BLACK
(0, 0, 0)
RED
(255, 0, 0)
GREEN
(0, 255, 0)
BLUE
(0, 0, 255)
Always capitalize colors T/F
T
Import Py game
import pygame
iniitialize pygame
Pygame.int()
Setup screen
surface = Pygame.display..set.mode((width, height), 0, 32)
make game loop
while loop
Width for drawings
optional but there is in elipse and rect where width isnt optional but linewidth is
default width for all
circle 1 others 0
top left x and y t/f
t
free
yay
Polygon
pygame.draw.polygon(Surface, color, (cords),width)
line
pygame.draw.line(surface, color, (startpoint), (endpoint), width)
circle
pygame.draw.circle(surface, color, (centerpoint), radius, width)
elipse
pygame.draw.ellipse(surface, color, (x, y, width, height), line width)
rect
pygame.draw.rect(surface, color, (x, y, width, height), line width)
set up font
basic(Font = pygame.SysFont(font, size)
set up text
text = basic Font.render(¨measure¨, true, textcolor, background color)
set location
textRect = text.get.rect()
textRect.centerx = number
textRect.centery = number
write onto screen
surface.blit(text, textRect)