"""
enemyA.py - These first small green enemies
"""

import common
import enemy
import random
import shotB
import explosionC

class EnemyA(enemy.Enemy):

    # rect = 2d only! width+height will be appended!
    def __init__(self, rect):        
        rect          += [19,15]
        enemy.Enemy.__init__(self,rect,5*(common.diff+1),1)
        self.images    = common.images['EnemyA']
        self.speed     = 3
        self.weapon    = { 'Delay':1,
                           'Type':1,
                           'Level':0,
                           'Status':0 }
        common.enemies.append(self)

    # from object.py
    def move(self):
        self.rect[1] += self.speed
        if self.rect[1] > common.resolution[1]:
            common.enemies.remove(self)
        w = self.weapon
        w['Delay'] -= 1
        if w['Delay'] <= 0: # shoot
            w['Delay'] = random.randrange(60,80)
            shotB.ShotB([self.rect[0]+self.rect[2]/2,self.rect[1]+self.rect[3]],w['Level'])

    # from enemy.py
    def explode(self):
        explosionC.ExplosionC(self.rect[:2])
        
