Innoviox/infinitus-vs-captain-zero

Implementing an Animated class for levers, buttons, springs, and a Moving class for doors, platforms, etc.

Opened this issue · 0 comments

I think these two classes would be a good idea as they encompass several possible attributes and can be implemented rather simply by inheriting from Enemy (or perhaps the other way around):

class Animated(Enemy):
    def __init__(self, *args):
        super().__init__(self, *args)

    def animate(self):
        global player1
        if pygame.sprite.collide_rect(self, player1):
            self.switch()
                   
    def switch(self):
        if self.frame == self.m:
            self.fc = -1
        if self.frame == 1:
            self.fc = 1

etc...with a similar-looking implementation for the Moving.