pybeamshow/effects/effect.py
2023-03-05 01:46:59 +01:00

45 lines
873 B
Python

from typing import Optional
import pygame as pg
from util.transform import PositionGenerator, transform_static
class Effect(pg.sprite.Sprite):
def __init__(
self, image: pg.Surface, rect: pg.Rect, *groups: pg.sprite.Group
) -> None:
super().__init__(*groups)
self.rect = rect
self.image = image
def draw(self, surface: pg.Surface):
surface.blit(self.image, self.rect)
class MovingEffect(Effect):
def __init__(
self,
image: pg.Surface,
rect: pg.Rect,
mover: Optional[PositionGenerator] = None,
*groups: pg.sprite.Group
) -> None:
super().__init__(image, rect, *groups)
self.mover = mover or transform_static(rect.center)
next(self.mover)
"""
square
line scan vh
starfield spawn chance
rainbow circle rotate
fix double spot 4 spots
"""