Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1 Импорт Нужных библиотек
- import pygame, sys
- #/1
- #2 Переменные
- fps = 24
- pygame.init()
- screen = pygame.display.set_mode((1080, 720))
- clock = pygame.time.Clock()
- display_width, display_height = pygame.display.Info().current_w, pygame.display.Info().current_h
- #list_polygon_1 = [[, ], [, ], [, ], [, ], [, ], [, ], [, ], [, ], [, ], [, ], [, ]]
- list_polygon_1 = [[100, 100], [300, 100], [200, 300]]
- color_polygon_1 = "red"
- otstup = 5
- #/2
- #3 Отрисовка Анимации
- while True:
- screen.fill("white")
- #4 Тут твой код для анимации
- for i in range(len(list_polygon_1)):
- list_polygon_1[i][0] += otstup
- if list_polygon_1[i][0] >= display_width or list_polygon_1[i][0] <= 0:
- otstup *= -1
- pygame.draw.polygon(screen, color_polygon_1, list_polygon_1)
- #/4
- #5 Обработчик Событий
- for event in pygame.event.get():
- if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
- pygame.quit()
- sys.exit()
- #/5
- #6 Магия
- pygame.display.flip()
- clock.tick(fps)
- #/6
- #/3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement