Created
April 20, 2020 20:57
-
-
Save LevBravE/d5a47efc3fda4db3cb5041f368a8ac00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
size = width, height = 301, 301 | |
screen = pygame.display.set_mode(size) | |
clock = pygame.time.Clock() | |
running = True | |
x_pos = 0 | |
v = 20 # пикÑелей в Ñекунду | |
while running: | |
# внутри игрового цикл еще один цикл | |
# приема и обработки Ñообщений | |
for event in pygame.event.get(): | |
# при закрытии окна | |
if event.type == pygame.QUIT: | |
running = False | |
# отриÑовка и изменение ÑвойÑтв объектов | |
# ... | |
screen.fill((0, 0, 0)) | |
pygame.draw.circle(screen, (255, 0, 0), (int(x_pos), 200), 20) | |
x_pos += v * clock.tick() / 1000 # v * t в Ñекундах | |
# обновление Ñкрана | |
pygame.display.flip() | |
pygame.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment