def shoot(self, bullets, baddies, fps):
        
        #    fyi...
        # Assuming fps=60 for comments mentioning
        # how long the alarm is set for.
        
        #shooter
        if self.selected == 0:
            
            #locked
            if self.unlocked[0] == 0:
                print("Warning: shooter is not unlocked yet")
                return -1
            
            #lvl 1
            elif self.unlocked[0] == 1:
                #allow a shot every 1/4 sec
                self.alarm = int(fps/4)
                #shoot a bullet
                if self.timer == 0:
                    self.timer += 1
                    bullet = Bullet(DGREY, 4, 8)
                    bullet.convertToPic(BULLET_LGREY, 1)
                    bullet.load(self, bullets)
                    bullet.aim(90, 5)
                    bullet.fire(6)

            #lvl 2
            elif self.unlocked[0] == 2:
                #allow a shot every 1/fps sec
                self.alarm = 1
                #shoot a bullet
                if self.timer == 0:
                    self.timer += 1
                    bullet = Bullet(DDGREY, 4, 8)
                    bullet.convertToPic(BULLET_GREY, 1)
                    bullet.load(self, bullets)
                    bullet.aim(90, 10)
                    bullet.fire(10)

            #lvl 3
            elif self.unlocked[0] == 3:
                #update bullet group for self
                self.bullets = bullets
                #allow a shot every 1/30 sec
                self.alarm = int(fps/30)
                #allow holding down to keep shooting
                self.event2 = True

            else:
                print("Error: player is trying to shoot with an incorrect upgrade selection")
                return -2
            
        #missile
        elif self.selected == 1:
            
            #locked
            if self.unlocked[1] == 0:
                print("Warning: missile is not unlocked yet")
                return -1
            
            #lvl 1
            elif self.unlocked[1] == 1:
                #allow a shot every 1 sec
                self.alarm = int(fps)
                #shoot a missile
                if self.timer == 0:
                    self.timer += 1
                    missile = MissileV3(windowSurface, MISSLE_BASIC, -90)
                    missile.setUpdateGroup( bullets )
                    bullets.add( missile )
                    missile.setCenter(self.rect.center)
                    missile.setDir( random.randint(87,93) )
                    missile.setSpeed( random.randint(300,500)/100 )
                    missile.setTrailStrength(1)
                    
            #lvl 2
            elif self.unlocked[1] == 2:
                #update bullet group for self
                self.bullets = bullets
                #allow a shot every 1/2 sec
                self.alarm = int(fps/2)
                #allow holding down to keep launching
                self.event4 = True

            #lvl 3
            elif self.unlocked[1] == 3:
                #allow a small missile every 1 sec
                self.alarm = int(fps*1)

                #25% chance for a large missile
                # ...
                #shoot 3 missiles
                if self.timer == 0:
                    self.timer += 1

                    #seeking bounds
                    bounds = [0,WINDOWWIDTH,self.rect.y,0]

                    special = random.randint(1,4)
                    if special == 1:
                        # 1 big seek missile
                        missile = MissileV3(windowSurface, MISSLE_HEAVY, -90)
                        missile.setUpdateGroup( bullets )
                        bullets.add( missile )
                        missile.setCenter(self.rect.center)
                        missile.setDir( 90 )
                        missile.setSpeed( random.randint(200,400)/100 )
                        missile.seek(baddies, 2, bounds)
                        missile.setTrailStrength(2)

                    # 2 small seek missiles
                    missile = MissileV3(windowSurface, MISSLE_BASIC, -90)
                    missile.setUpdateGroup( bullets )
                    bullets.add( missile )
                    missile.setCenter(self.rect.center)
                    missile.setDir( random.randint(82,88) )
                    missile.setSpeed( random.randint(400,600)/100 )
                    missile.seek(baddies, 5, bounds)
                    missile.setTrailStrength(0)
                    
                    missile = MissileV3(windowSurface, MISSLE_BASIC, -90)
                    missile.setUpdateGroup( bullets )
                    bullets.add( missile )
                    missile.setCenter(self.rect.center)
                    missile.setDir( random.randint(92,98) )
                    missile.setSpeed( random.randint(400,600)/100 )
                    missile.seek(baddies, 5, bounds)
                    missile.setTrailStrength(0)

            else:
                print("Error: player is trying to shoot with an incorrect upgrade selection")
                return -2
            
        #sprayer
        elif self.selected == 2:

            #locked
            if self.unlocked[2] == 0:
                print("Warning: sprayer is not unlocked yet")
                return -1
            
            #lvl 1
            elif self.unlocked[2] == 1:
                #allow a shot every 1 sec
                self.alarm = int(fps)
                #shoot 3 bullets, 4 fragments
                if self.timer == 0:
                    self.timer += 1
                    bullet = Bullet(DDGREY, 7, 7)
                    bullet.load(self, bullets)
                    bullet.aim(90, 4)
                    bullet.fire(16) #--1
                    bullet = Bullet(DDGREY, 7, 7)
                    bullet.load(self, bullets)
                    bullet.aim(95, 6)
                    bullet.fire(15) #--2
                    bullet = Bullet(DDGREY, 7, 7)
                    bullet.load(self, bullets)
                    bullet.aim(85, 6)
                    bullet.fire(15) #--3

            #lvl 2
            elif self.unlocked[2] == 2:
                #update bullet group for self
                self.bullets = bullets
                #allow a shot every 1/10 sec
                self.alarm = int(fps/10)
                #allow holding down to keep shooting
                self.event5 = True

            #lvl 3
            elif self.unlocked[2] == 3:
                #update bullet group for self
                self.bullets = bullets
                #allow a shot every 1/15 sec
                self.alarm = int(fps/15)
                #allow holding down to keep shooting
                self.event3 = True

            else:
                print("Error: player is trying to shoot with an incorrect upgrade selection")
                return -2
            
        #minions
        elif self.selected == 3:
            
            #locked
            if self.unlocked[3] == 0:
                print("Warning: minions are not unlocked yet")
                return -1
            
            #lvl 1
            elif self.unlocked[3] == 1:
                #allow a shot every 0.5 sec
                self.alarm = int(fps/2)
                    
                #create a random suicide minion
                if self.timer == 0:
                    self.timer += 1
                    suiciders = [MINION_1,MINION_2,MINION_3]
                    minion = Minion(windowSurface, random.choice(suiciders), -90)
                    minion.init()

                    #place minion randomly in front of self
                    # N,E,S,W
                    bounds = [self.rect.centery-80,self.rect.centerx+50,self.rect.y-10,self.rect.centerx-50]
                    cx = random.randint(bounds[3],bounds[1])
                    cy = random.randint(bounds[0],bounds[2])
                    minion.setCenter( (cx,cy) )
                    
                    #set type, update group, target group
                    minion.type = 1
                    minion.setUpdateGroup(bullets)
                    minion.setTargetGroup(baddies)

                    #load minion into update group
                    bullets.add(minion)

                    #set current minion
                    self.currMinion = minion

            #lvl 2
            elif self.unlocked[3] == 2:
                #allow a shot every 1/6 sec
                self.alarm = int(fps/6)

                #create a shooter minion
                if self.timer == 0:
                    self.timer += 1

                    #only if fewer than 2 shooter-minions are alive
                    if len(self.pop2) < 2:

                        # bounds: N,E,S,W
                        bounds = [self.rect.centery-35,self.rect.centerx+50,self.rect.y+15,self.rect.centerx-50]
                        cx = random.randint(bounds[3],bounds[1])
                        cy = random.randint(bounds[0],bounds[2])
                        
                        #pick a side this minion will be on (right/left)
                        if cx >= WINDOWWIDTH/2:
                            pic = MINION_4 #right
                            side = 1
                        else:
                            pic = MINION_5 #left
                            side = 2

                        #create a shooter minion
                        minion = Minion(windowSurface, pic, -90)
                        minion.init()
                        minion.side = side

                        #place minion randomly in front of self
                        minion.setCenter( (cx,cy) )
                        
                        #set type, alarm, update group, target group
                        minion.type = 2
                        minion.alarm = 60*2
                        minion.setUpdateGroup(bullets)
                        minion.setTargetGroup(baddies)

                        #load minion into update group, pop2
                        bullets.add(minion)
                        self.pop2.append(minion)

                        #set current minion
                        self.currMinion = minion

            #lvl 3
            elif self.unlocked[3] == 3:
                #allow a shot every 0.25 sec
                self.alarm = int(fps/4)

                #create an army minion
                if self.timer == 0:
                    self.timer += 1

                    #only if fewer than 8 army-minions are alive
                    if len(self.pop3) < 8:

                        #create a random army minion
                        armies = { 1 : ARMY_1,   #flames
                                   2 : ARMY_2,   #missiles
                                   3 : ARMY_3 }  #lasers
                        choice = random.randint(1,3)
                        minion = Minion(windowSurface, armies[choice], -90)
                        minion.init()

                        # bounds: N,E,S,W
                        bounds = [self.rect.centery-35,self.rect.centerx+50,self.rect.y+15,self.rect.centerx-50]
                        cx = random.randint(bounds[3],bounds[1])
                        cy = random.randint(bounds[0],bounds[2])

                        #place minion randomly in front of self
                        minion.setCenter( (cx,cy) )
                        
                        #set type, health, subtype, alarm, update group, target group, dir
                        minion.type = 3
                        minion.health = 40
                        if choice == 1:
                            minion.alarm = 60/6
                            minion.subtype = "red"
                        elif choice == 2:
                            minion.alarm = 60*2
                            minion.subtype = "blue"
                        elif choice == 3:
                            minion.alarm = 60/3
                            minion.subtype = "green"
                        minion.setUpdateGroup(bullets)
                        minion.setTargetGroup(baddies)
                        minion.setDir(90)

                        #load minion into update group, pop3
                        bullets.add(minion)
                        self.pop3.append(minion)

                        #set current minion
                        self.currMinion = minion

            else:
                print("Error: player is trying to shoot with an incorrect upgrade selection")
                return -2
        
        #bombs (NOTE*** attractor and reflector do not attract/reflect enemies)
        elif self.selected == 4:

            #locked
            if self.unlocked[4] == 0:
                print("Warning: bombs are not unlocked yet")
                return -1
            
            #lvl 1
            elif self.unlocked[4] == 1:
                #allow a shot every 1/2 sec
                self.alarm = int(fps/2)
                #throws 1 bomb
                if self.timer == 0:
                    self.timer += 1
                    bomb = Bomb(windowSurface, BOMB_SMALL)
                    bomb.initVars()
                    bomb.setCenter(self.rect.center)
                    bomb.setUpdateGroup(bullets)
                    bomb.setDensity(15)
                    bomb.setSmoke(5)
                    bomb.setAmt(10)
                    bullets.add(bomb)
                    bomb.dir = random.randint(60, 120)
                    bomb.speed = random.randint(115,190)/10
                    bomb.accel = -random.randint(5,7)/10

            #lvl 2
            elif self.unlocked[4] == 2:
                #allow a shot every 2 sec
                self.alarm = int(fps*2)
                #throws 1 reflector
                if self.timer == 0:
                    self.timer += 1
                    bomb = Bomb(windowSurface, BOMB_REFLECT)
                    bomb.initVars()
                    bomb.setCenter(self.rect.center)
                    bomb.setUpdateGroup(bullets)
                    bullets.add(bomb)
                    bomb.dir = 90
                    bomb.speed = 2
                    bomb.setReflect(0.8)

            #lvl 3
            elif self.unlocked[4] == 3:
                #allow a shot every 4 sec
                self.alarm = int(fps*4)
                #throws 1 attractor
                if self.timer == 0:
                    self.timer += 1

                    #seeking bounds
                    bounds = [0,WINDOWWIDTH,self.rect.y,0]

                    #attractor (also launches missiles)
                    bomb = Bomb(windowSurface, BOMB_ATTRACT)
                    bomb.initVars()
                    bomb.setCenter(self.rect.center)
                    bomb.setUpdateGroup(bullets)
                    bullets.add(bomb)
                    bomb.dir = 90
                    bomb.speed = 2
                    bomb.setAttract(0.7, baddies, bounds)

            else:
                print("Error: player is trying to shoot with an incorrect upgrade selection")
                return -2
            
        #error
        else:
            print("Error: player is trying to shoot with an incorrect weapon selection")
            return -2

        #if all goes well, return 0
        return 0
    def updateEvents(self):
        
        #movement
        if self.event1 == True:
            #stop from leaving window
            #left edge
            if self.rect.left > 0:
                self.rect.x += self.xspeed
            elif self.xspeed < 0:
                self.stopX()
                self.rect.left = 0
            #right edge
            if self.rect.right < WINDOWWIDTH:
                self.rect.x += self.xspeed
            elif self.xspeed > 0:
                self.stopX()
                self.rect.right = WINDOWWIDTH
            #top edge
            if self.rect.top > 0:
                self.rect.y += self.yspeed
            elif self.yspeed < 0:
                self.stopY()
                self.rect.top = 0
            #bottom edge
            if self.rect.bottom < WINDOWHEIGHT:
                self.rect.y += self.yspeed
            elif self.yspeed > 0:
                self.stopY()
                self.rect.bottom = WINDOWHEIGHT
                
        #shooting (lvl 3)
        if self.event2 == True:
            #shoot a bullet
            if self.timer == 0:
                self.timer += 1
                bullet = Bullet(BLACK, 4, 8)
                bullet.convertToPic(BULLET_DGREY, 1)
                bullet.load(self, self.bullets)
                bullet.aim(90, 1)
                bullet.fire(18)

        #sprayer (lvl 2)
        if self.event3 == True:
            if self.timer == 0:
                self.timer += 1
                flame = FlameV2(YELLOW, 6, 6, 24, 24)
                flame.load(self, self.bullets, 'N')
                flame.aim(90, 30)
                flame.fire(5)
                flame.wiggle = True #--1
                flame = FlameV2(YELLOW, 6, 6, 24, 24)
                flame.load(self, self.bullets, 'N')
                flame.aim(100, 30)
                flame.fire(5)       #--2
                flame = FlameV2(YELLOW, 6, 6, 24, 24)
                flame.load(self, self.bullets, 'N')
                flame.aim(80, 30)
                flame.fire(5)       #--3
                flame = FlameV2(YELLOW, 6, 6, 24, 24)
                flame.load(self, self.bullets, 'N')
                flame.aim(95, 15)
                flame.fire(5)
                flame.wiggle = True #--4
                flame = FlameV2(YELLOW, 6, 6, 24, 24)
                flame.load(self, self.bullets, 'N')
                flame.aim(85, 15)
                flame.fire(5)
                flame.wiggle = True #--5

        #missile (lvl 2)
        if self.event4 == True:
            if self.timer == 0:
                self.timer += 1
                missile = MissileV3(windowSurface, MISSLE_BASIC, -90)
                missile.setUpdateGroup( self.bullets )
                self.bullets.add( missile )
                missile.setCenter(self.rect.center)
                missile.setDir( random.randint(87,93) )
                missile.setSpeed( random.randint(300,500)/100 )
                missile.setTrailStrength(1)

        #sprayer (lvl 3)
        if self.event5 == True:
            if self.timer == 0:
                self.timer += 1
                #shoot 5 different bullets
                side = random.randint(8,10)
                bullet = Bullet(DDBLUE, side,side)
                bullet.load(self, self.bullets)
                bullet.aim(90, 5)
                bullet.yaccel = 0.35
                bullet.special_01()
                bullet.fire(random.randint(10,14)) #--1
                side = random.randint(8,10)
                bullet = Bullet(DDBLUE, side,side)
                bullet.load(self, self.bullets)
                bullet.aim(87, 4)
                bullet.yaccel = 0.35
                bullet.special_01()
                bullet.fire(random.randint(10,14)) #--2
                side = random.randint(8,10)
                bullet = Bullet(DDBLUE, side,side)
                bullet.load(self, self.bullets)
                bullet.aim(83, 3)
                bullet.yaccel = 0.35
                bullet.special_01()
                bullet.fire(random.randint(10,14)) #--3
                side = random.randint(8,10)
                bullet = Bullet(DDBLUE, side,side)
                bullet.load(self, self.bullets)
                bullet.aim(93, 4)
                bullet.yaccel = 0.35
                bullet.special_01()
                bullet.fire(random.randint(10,14)) #--4
                side = random.randint(8,10)
                bullet = Bullet(DDBLUE, side,side)
                bullet.load(self, self.bullets)
                bullet.aim(97, 3)
                bullet.yaccel = 0.35
                bullet.special_01()
                bullet.fire(random.randint(10,14)) #--5

        #update target group for current minion
        if self.currMinion == None and self.baddies != None:
            self.currMinion.setTargetGroup(self.baddies)