school-horror-game/scripts/animation.py

23 lines
598 B
Python
Raw Permalink Normal View History

2026-11-11 17:32:27 +00:00
import math
class Animation:
def __init__(self, images, image_duration=0.125, loop=True):
if not images:
raise ValueError("Eine Animation benötigt mindestens ein Bild.")
if not math.isfinite(image_duration) or image_duration <= 0:
raise ValueError("Die Bilddauer muss endlich und größer als null sein.")
self.images = images
self.image_duration = image_duration
self.loop = loop
self.time = 0.0
self.done = False
def copy(self):
return Animation(self.images, self.image_duration, self.loop)