/
Dragon925
/
Python-Graphics
Обзор
Документация
Войти
/
Dragon925
/
Python-Graphics
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
lesson_29
dino.py
44 строки
1 KB
Alexandr Romanov
Пример выполнения задания 11
24 апр 2025, 20:03
24 апр 2025, 20:03
bc44fc5
Код
Авторство
О чём код?
import pygame import display import moving import creation import edit_obstacles from classes import Obstacle # Параметры игрового поля и fps WIDTH, HEIGHT = 1400, 600 start_fps = 70 fps = start_fps pygame.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) clock = pygame.time.Clock() dino, ground, clouds, obstacles = creation.create_world( WIDTH, HEIGHT, -10, 0.25, 10, 4, 2, 10, 9, 10 ) current_obstacles: list[Obstacle] = [] timer = 1 while True: # Выход по нажатию крестика for event in pygame.event.get(): if event.type == pygame.QUIT: exit() current_obstacles = edit_obstacles.check_new_obstacles(current_obstacles, obstacles, WIDTH) display.draw_world(screen, dino, ground, clouds, current_obstacles) moving.move(WIDTH, HEIGHT, dino, ground, clouds, current_obstacles) current_obstacles = edit_obstacles.delete_first_obstacle(current_obstacles) if timer % (fps // 10) == 0: dino.animate() timer = (timer + 1) % fps pygame.display.update() clock.tick(fps)