/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/py-502-312-011/main.py
16 строк
530 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
class Platform(pygame.sprite.Sprite): def __init__(self, x, y, w, h): super().__init__() self.image = pygame.Surface((w, h)) self.image.fill((100, 100, 100)) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y # В цикле игрока hits = pygame.sprite.spritecollide(player, platforms, False) if hits: if player.vel_y > 0: # Падение вниз player.rect.bottom = hits[0].rect.top player.vel_y = 0 player.jumping = False