diff --git a/pyanimate.py b/pyanimate.py index 064cdd3..3d449b0 100644 --- a/pyanimate.py +++ b/pyanimate.py @@ -48,6 +48,7 @@ class Video(object): class Source(object): def __init__(self, file_path): self.file_path = file_path + self.load() def load(self): """ @@ -77,7 +78,7 @@ class Sprite(object): def next_frame(self): for animation in self.get_pending_animations(): - animation.apply() + animation.apply(self) def draw(self, canvas): """ @@ -86,16 +87,17 @@ class Sprite(object): raise NotImplementedError() -def ImageSprite(Sprite): +class ImageSprite(Sprite): def __init__(self, source, position=(0, 0)): - raise Exception("huh") - # super().__init__(source, position) + super().__init__(source, position) def draw(self, canvas): """ Draw the sprite on top of the given canvas """ - raise NotImplementedError() + # raise NotImplementedError("xd") + # pass + canvas.paste(self.source.img, (0, 0)) class Animation(object): diff --git a/test.py b/test.py index c8b65cb..39cce19 100644 --- a/test.py +++ b/test.py @@ -24,7 +24,7 @@ video = Video(framerate=30, width=640, height=480) # a Source is a piece of media that we can include in the animation # there should not be any reason to create two Source()s of the same input media. -logo_img = ImageSource("dvd_logo.png") +logo_img = ImageSource("dvd.png") # a Sprite is an instance of a piece of media. They contain contextual information such as the position of the sprite # on the canvas.