Skip to content

Instantly share code, notes, and snippets.

@LevBravE
Created April 20, 2020 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LevBravE/46dd92e8d31434ad81d899949d33bc82 to your computer and use it in GitHub Desktop.
Save LevBravE/46dd92e8d31434ad81d899949d33bc82 to your computer and use it in GitHub Desktop.
import pygame
size = width, height = 301, 301
screen = pygame.display.set_mode(size)
running = True
x_pos = 0
while running:
# внутри игрового цикл еще один цикл
# приема и обработки сообщений
events = pygame.event.get()
for event in events:
# при закрытии окна
if event.type == pygame.QUIT:
running = False
# отрисовка и изменение свойств объектов
# ...
screen.fill((0, 0, 0))
pygame.draw.circle(screen, (255, 0, 0), (x_pos, 200), 20)
x_pos += 1
# обновление экрана
pygame.display.flip()
pygame.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment