import pyglet
from game import gameobject, assets

class Anim(gameobject.GameObject):
    def __init__(self, *args, **kwargs):
        super(Anim, self).__init__(*args, **kwargs)

        self.is_active = False

    def toggle_active(self, dt):
        if not self.is_active:
            pyglet.clock.schedule_once(self.toggle_active, 0.3)

        self.is_active = not self.is_active

    def update(self, dt):
        super(Anim, self).update(dt)

        if self.is_active:
            self.image = assets.alien_1_active
        else:
            self.image = assets.alien_1_inactive
