"""
explosionE.py - explosion class E (for largest explosions)
"""

import common
import misc

class ExplosionE(misc.Misc):

    # 2d rect! width+height will be appended
    def __init__(self,rect,delay=3):
        self.rect  = rect+[64,64]
        misc.Misc.__init__(self,-1,self.rect)
        self.images   = common.images['ExplosionE']
        self.state    = 0
        self.maxstate = 9
        self.delay    = delay
        self.newdelay = delay

        common.misc_neutral.append(self)

    # from object.py
    def move(self):
        self.delay -= 1
        if self.delay <= 0:
            self.delay = self.newdelay
            self.state += 1
            if self.state >= self.maxstate:
                self.kill()

    # from object.py
    def show(self):
        r = common.screen.blit(self.images[self.state],self.rect)
        return self.optimizeDirtyRect(r)

    # from misc.py
    def remove(self):
        common.misc_neutral.remove(self)
