/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/py-502-312-005/main.py
14 строк
485 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
class Bullet(pygame.sprite.Sprite): def __init__(self, x, y, dir_x, dir_y, speed=10): super().__init__() self.image = pygame.Surface((8, 8)) self.image.fill((255, 255, 0)) self.rect = self.image.get_rect(center=(x, y)) self.vx = dir_x * speed self.vy = dir_y * speed def update(self): self.rect.x += self.vx self.rect.y += self.vy if not screen.get_rect().colliderect(self.rect): self.kill()