Ejemplo n.º 1
0
def StageTwo(hero, winstyle = 0):
        
        # Initialize screen
        pygame.init()
        bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32)
        screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth)
        pygame.display.set_caption('Cyborg-Fu!')

        # Creating Background
        bgdtile = load_image('graytile.png')
        background = pygame.Surface(SCREENRECT.size)
        for x in range(0, SCREENRECT.width, bgdtile.get_width()):
                for y in range(0, SCREENRECT.height, bgdtile.get_width()):
                        background.blit(bgdtile, (x, y))

        #Missle & Attack object groups must be determined before characters.
        shots = pygame.sprite.Group()
        pshots = pygame.sprite.Group()
        clubs = pygame.sprite.Group()
        blade = pygame.sprite.Group()
        blood = pygame.sprite.Group()
        ogres = pygame.sprite.Group()

        #scoreboard
        score = Score()
        scoresprite = pygame.sprite.RenderPlain(score)
        

        prof = Creature("prof", [740, 30], [1, 1], [10], "still", "prof.png", "nil")
        Ogre([100, 100], clubs)
        
        #Text
        TEXT = "Ogres may seem stupid, but they're a lot smarter than runts! Be careful!"
        text = Text(TEXT)
        textgroup = pygame.sprite.Group()
        
        
        #Create Characters
        global tesi
        global gunner
        if hero == "tesi":
                tesi = Tesi(blade)
                life = Life(tesi)
                Mana(tesi)
                lifesprite = pygame.sprite.RenderPlain(life)
                heroes = pygame.sprite.Group(tesi)
                sprites = pygame.sprite.Group(tesi, prof, score, life, text)
        if hero == "gunner":
                gunner = Hero(shots)
                life = Life(gunner)
                Mana(gunner)
                lifesprite = pygame.sprite.RenderPlain(life)
                heroes = pygame.sprite.Group(gunner)
                sprites = pygame.sprite.Group(gunner, prof, score, life, text)

        #Assign life values
        Alives = 0
        Blives = 0

        #Checkmarks to avoid repeating text
        CHECKMARK1 = 0
        CHECKMARK2 = 0
        CHECKMARK3 = 0
        
        #Default groups for each sprite class
        Creature.containers = sprites
        Shot.containers = shots
        PowerShot.containers = pshots
        Ogre.containers = ogres
        Text.containers = sprites
        
        # Blit everything to the screen
        screen.blit(background, (0, 0))
        pygame.display.flip()

        # Initialise clock
        clock = pygame.time.Clock()

        #Tesi's blade
        BLADE = 1
        COLLIDELATENCY = 0
        ogrereload = OGRE_RELOAD
        
        # Event loop
        while 1:
    
                clock.tick(60)

                COLLIDELATENCY = COLLIDELATENCY - 1
                
                """Creating actions that cause a change in dialogue"""
                if score.score == 4:
                        if CHECKMARK1 == 0:
                                msg = "These Ogres cost a lot, I hope you can handle more than two!"
                                newText = Text(msg)
                                sprites.add(newText)
                                CHECKMARK1 = 1
                
                if ogrereload:
                        ogrereload = ogrereload - 1
                elif not int(random.random() * OGRE_ODDS):
                        choice = random.choice((1,2,3,4,5))
                        if choice == 1:
                                if Alives <= 0:
                                        loc = [100, 50]
                                        ogreA = Ogre(loc, clubs)
                                        ogres.add(ogreA)
                                        Alives = 1
                        if choice == 2: 
                                if Blives <= 0:
                                        loc = [200, 50]
                                        ogreB = Ogre(loc, clubs)
                                        ogres.add(ogreB)
                                        Blives = 1
                                        
                        ogrereload = OGRE_RELOAD
                            
                if hero == "tesi":
                        for event in pygame.event.get():
                                if event.type == QUIT: 
                                        pygame.quit()
                                        return
                                if event.type == KEYDOWN:
                                        if event.key == K_e:
                                                tesi.healing = 1
                                        if event.key == K_SPACE:
                                                if BLADE == 1:
                                                        tesi.throw(blade)
                                                        BLADE = BLADE - 1
                                                        COLLIDELATENCY = 60

                                                        if Alives == 1:
                                                                ogreA.dodge()
                                                        if Blives == 1:
                                                                ogreB.dodge()
                                        if event.key == K_w:
                                                tesi.moveup()
                                        if event.key == K_s:
                                                tesi.movedown()
                                        if event.key == K_a:
                                                tesi.moveleft()
                                        if event.key == K_d:
                                                tesi.moveright()
                                        if event.key == K_l:
                                                if BLADE == 1:
                                                        tesi.swing(blade)
                                                        COLLIDELATENCY = 150
                                elif event.type == KEYUP:
                                        if event.key == K_e:
                                                tesi.healing = 0
                                        if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
                                                tesi.state = "still"

                        # Tesi gets his blade back
                        if COLLIDELATENCY <= 0:
                                if pygame.sprite.spritecollide(tesi, blade, dokill):
                                        BLADE = BLADE + 1

                        if pygame.sprite.spritecollide(tesi, clubs, dontkill):
                                tesi.bleed(blood)
                                tesi.life = tesi.life - 6


                if hero == "gunner":
                        for event in pygame.event.get():
                                if event.type == QUIT: 
                                        pygame.quit()
                                        return
                                if event.type == KEYDOWN:
                                        if event.key == K_e:
                                                gunner.powershot(pshots)
                                        if event.key == K_SPACE:
                                                gunner.doublefire(shots)

                                                if Alives == 1:
                                                        ogreA.dodge()
                                                if Blives == 1:
                                                        ogreB.dodge()
                                                        
                                        if event.key == K_w:
                                                gunner.moveup()
                                        if event.key == K_s:
                                                gunner.movedown()
                                        if event.key == K_a:
                                                gunner.moveleft()
                                        if event.key == K_d:
                                                gunner.moveright()
                                elif event.type == KEYUP:
                                        if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
                                                gunner.state = "still"


                        if pygame.sprite.spritecollide(gunner, clubs, dontkill):
                                gunner.bleed(blood)
                                gunner.life = gunner.life - 10
                                gunner.knockback()

                if hero == "tesi":
                            loc = tesi.rect
                if hero == "gunner":
                            loc = gunner.rect
                            
                if Alives == 1:
                        ogreA.chase(loc)
                        ogreA.tryclub(loc)
                        if pygame.sprite.spritecollide(ogreA, shots, dokill):
                                ogreA.bleed(blood)
                                ogreA.life = ogreA.life - 10
                                if ogreA.life <= 0:
                                        Alives = 0
                                        score.plus(2)
                        if pygame.sprite.spritecollide(ogreA, pshots, dontkill):
                                ogreA.bleed(blood)
                                ogreA.life = ogreA.life - 15
                                if ogreA.life <= 0:
                                        Alives = 0
                                        score.plus(2)
                        if pygame.sprite.spritecollide(ogreA, blade, dontkill):
                                ogreA.bleed(blood)
                                ogreA.life = ogreA.life - 4
                                if ogreA.life <= 0:
                                        Alives = 0
                                        score.plus(2)
                if Blives == 1:
                        ogreB.chase(loc)
                        ogreB.tryclub(loc)
                        if pygame.sprite.spritecollide(ogreB, shots, dokill):
                                ogreB.bleed(blood)
                                ogreB.life = ogreB.life - 10
                                if ogreB.life <= 0:
                                        Blives = 0
                                        score.plus(2)
                        if pygame.sprite.spritecollide(ogreB, pshots, dontkill):
                                ogreB.bleed(blood)
                                ogreB.life = ogreB.life - 15
                                if ogreB.life <= 0:
                                        Blives = 0
                                        score.plus(2)
                        if pygame.sprite.spritecollide(ogreB, blade, dontkill):
                                ogreB.bleed(blood)
                                ogreB.life = ogreB.life - 4
                                if ogreB.life <= 0:
                                        Blives = 0
                                        score.plus(2)

                if pygame.sprite.spritecollide(prof, ogres, dontkill):
                        msg = "Professor: (Sigh) Attack the subject, stupid ogres!"
                        newText = Text(msg)
                        sprites.add(newText)
                        ogres.empty()
                        Alives = 0
                        Blives = 0

                if pygame.sprite.spritecollide(prof, heroes, dontkill):
                        if score.score <= 9:
                                if CHECKMARK2 == 0:
                                        msg = "Professor: Attack the ogres, let me see what you can do!"
                                        newText = Text(msg)
                                        sprites.add(newText)
                                        CHECKMARK2 = 1
                        if score.score >= 10:
                                if CHECKMARK3 == 0:
                                        msg = "Excellent work. What shall be your next challenge.. hm?"
                                        newText = Text(msg)
                                        sprites.add(newText)
                                        CHECKMARK3 = 1
                                        ogres.empty()
                                        Alives = 2
                                        Blives = 2
                                        StageThree(hero)

                ogres.clear(screen, background)
                ogres.update()
                ogres.draw(screen)

                blood.clear(screen, background)
                blood.update()
                blood.draw(screen)
                
                shots.clear(screen, background)
                shots.update()
                shots.draw(screen)

                pshots.clear(screen, background)
                pshots.update()
                pshots.draw(screen)
                
                blade.clear(screen, background)
                blade.update()
                blade.draw(screen)

                clubs.clear(screen, background)
                clubs.update()
                clubs.draw(screen)

                textgroup.clear(screen, background)
                textgroup.update()
                textgroup.draw(screen)
                
                sprites.clear(screen, background)
                sprites.update()
                sprites.draw(screen)
                
                pygame.display.flip()
Ejemplo n.º 2
0
def StageThree(hero, winstyle = 0):

        # Initialize screen
        pygame.init()
        bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32)
        screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth)
        pygame.display.set_caption('Cyborg-Fu!')

        # Creating Background
        bgdtile = load_image('rivers.png')
        background = pygame.Surface(SCREENRECT.size)
        background.blit(bgdtile, (0,0))

        #Missle & Attack object groups must be determined before characters.
        shots = pygame.sprite.Group()
        pshots = pygame.sprite.Group()
        ashots = pygame.sprite.Group()
        fakeshots = pygame.sprite.Group()
        shadows = pygame.sprite.Group()
        blade = pygame.sprite.Group()
        blood = pygame.sprite.Group()

        #Scoreboard
        score = Score()
        scoresprite = pygame.sprite.RenderPlain(score)

        assassin = Assassin([100, 100], ashots)
        Shadow([100,300], fakeshots, "left", [0,0])

        #Text
        TEXT = "They sent an 'The Assassin' for me! Please, defeat him!"
        text = Text(TEXT)
        
        
        #Create Characters
        global tesi
        global gunner
        if hero == "tesi":
                tesi = Tesi(blade)
                life = Life(tesi)
                Mana(tesi)
                lifesprite = pygame.sprite.RenderPlain(life)
                heroes = pygame.sprite.Group(tesi)
                objects = pygame.sprite.Group(tesi, assassin, score, life, text)
        if hero == "gunner":
                gunner = Hero(shots)
                life = Life(gunner)
                Mana(gunner)
                lifesprite = pygame.sprite.RenderPlain(life)
                heroes = pygame.sprite.Group(gunner)
                objects = pygame.sprite.Group(gunner, assassin, score, life, text)

        #Creating an impassable block! Excitement abounds!
        #Block works! Now to map out the river!
        middle = Block([420, 10])
        middle1 = Block([420, 40])
        middle2 = Block([420, 80])
        middle3 = Block([420, 120])
        middle4 = Block([430, 160])
        middle5 = Block([430, 200])
        middle6 = Block([460, 240])
        middle7 = Block([430, 280])
        middle8 = Block([420, 310])
        middle9 = Block([413, 400])
        middle10 = Block([435, 434])
        middle11 = Block([455, 456])
        middle12 = Block([488, 488])
        middle13 = Block([520, 496])
        middle14 = Block([557, 503])
        middle15 = Block([575, 536])
        middle16 = Block([588, 564])
        east1 = Block([464, 153])
        east2 = Block([504, 175])
        east3 = Block([543, 181])
        east4 = Block([574, 210])
        east5 = Block([575, 303])
        east6 = Block([570, 351])
        east7 = Block([544, 371])
        east8 = Block([524, 404])
        east9 = Block([495, 421])
        west1 = Block([376, 188])
        west2 = Block([323, 202])
        west3 = Block([290, 213])
        west4 = Block([240, 220])
        west5 = Block([141, 209])
        west6 = Block([108, 163])
        west7 = Block([72, 148])
        west8 = Block([42, 133])
        west9 = Block([3, 121])
        
        #Checkmarks to avoid repeating text
        CHECKMARK1 = 0
        CHECKMARK2 = 0
        
        #Create Game Groups
        gassassin = pygame.sprite.Group(assassin)
        blocks = pygame.sprite.Group(middle, middle1, middle2,
                                     middle3, middle4, middle5,
                                     middle6, middle7, middle8,
                                     middle9, middle10, middle11,
                                     middle12, middle13, middle14,
                                     middle15, middle16, east1,
                                     east2, east3, east4, east5,
                                     east6, east7, east8, east9,
                                     west1, west2, west3, west4,
                                     west5, west6, west7, west8,
                                     west9)
        
        #Default groups for each sprite class
        Shot.containers = shots
        PowerShot.containers = pshots
        Shadow.containers = shadows
        
        # Blit everything to the screen
        screen.blit(background, (0, 0))
        pygame.display.flip()

        #Tesi's blade
        BLADE = 1
        COLLIDELATENCY = 0

        #Assassin creates an illusional shadow
        shadowspawn = SHADOW_SPAWN
        SALIVE = 0

        # Initialise clock
        clock = pygame.time.Clock()

        # Event loop
        while 1:
            
                clock.tick(60)

                COLLIDELATENCY = COLLIDELATENCY - 1
                if hero == "tesi":
                        loc = tesi.rect
                if hero == "gunner":
                        loc = gunner.rect
                        
                assassin.aim(loc)

                if SALIVE == 1:
                        shadow.aim(loc)

                if shadowspawn > 0:
                        shadowspawn = shadowspawn - 1
                elif not int(random.random() * SHADOW_ODDS):
                        shadowspawn = SHADOW_SPAWN
                        loc = assassin.rect.center
                        facing = assassin.facing
                        running = assassin.movepos
                        shadow = Shadow(loc, fakeshots, facing, running)
                        shadows.add(shadow)
                        SALIVE = 1
                            
                if hero == "tesi":
                        for event in pygame.event.get():
                                if event.type == QUIT: 
                                        pygame.quit()
                                        return
                                if event.type == KEYDOWN:
                                        if event.key == K_e:
                                                tesi.healing = 1
                                        if event.key == K_SPACE:
                                                if BLADE == 1:
                                                        tesi.throw(blade)
                                                        BLADE = BLADE - 1
                                                        COLLIDELATENCY = 60
                                                        assassin.dodge()
                                        if event.key == K_w:
                                                tesi.moveup()
                                        if event.key == K_s:
                                                tesi.movedown()
                                        if event.key == K_a:
                                                tesi.moveleft()
                                        if event.key == K_d:
                                                tesi.moveright()
                                        if event.key == K_l:
                                                if BLADE == 1:
                                                        tesi.swing(blade)
                                                        COLLIDELATENCY = 150
                                elif event.type == KEYUP:
                                        if event.key == K_e:
                                                tesi.healing = 0
                                        if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
                                                tesi.state = "still"

                        # Tesi gets his blade back
                        if COLLIDELATENCY <= 0:
                                if pygame.sprite.spritecollide(tesi, blade, dokill):
                                        BLADE = BLADE + 1

                        if pygame.sprite.spritecollide(tesi, ashots, dokill):
                                tesi.bleed(blood)
                                tesi.life = tesi.life - 6


                if hero == "gunner":
                        for event in pygame.event.get():
                                if event.type == QUIT: 
                                        pygame.quit()
                                        return
                                if event.type == KEYDOWN:
                                        if event.key == K_e:
                                                gunner.powershot(pshots)
                                        if event.key == K_SPACE:
                                                gunner.doublefire(shots)
                                                assassin.dodge()
                                                        
                                        if event.key == K_w:
                                                gunner.moveup()
                                        if event.key == K_s:
                                                gunner.movedown()
                                        if event.key == K_a:
                                                gunner.moveleft()
                                        if event.key == K_d:
                                                gunner.moveright()
                                elif event.type == KEYUP:
                                        if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
                                                gunner.state = "still"


                        if pygame.sprite.spritecollide(gunner, ashots, dokill):
                                gunner.bleed(blood)
                                gunner.life = gunner.life - 10
                                gunner.knockback()
                      

                if pygame.sprite.groupcollide(shadows, blade, dokill, dontkill) or pygame.sprite.groupcollide(shadows, shots, dokill, dokill):
                        a = "Assassin: What's the matter? Can't hit me? Haha!"
                        b = "Assassin: Come on, stop trying to hit me and hit me!"
                        c = "Assassin: What are you swinging at? I'm right here!"
                        d = "Assassin: Bwahahahaha!"
                        e = "Assassin: Super ketchup, premio tomato, catfish tuna."
                        msg = random.choice((a, b, c, d, e))
                        newText = Text(msg)
                        objects.add(newText)
                        shadows.empty()
                        SALIVE = 0

                if pygame.sprite.spritecollide(assassin, blade, dontkill):
                        assassin.bleed(blood)
                        assassin.life = assassin.life - 2
                        score.plus(1)

                if pygame.sprite.spritecollide(assassin, shots, dokill):
                        assassin.bleed(blood)
                        assassin.life = assassin.life - 5
                        score.plus(1)

                if pygame.sprite.spritecollide(assassin, pshots, dontkill):
                        assassin.bleed(blood)
                        assassin.life = assassin.life - 8
                        score.plus(1)

                if pygame.sprite.groupcollide(blocks, heroes, dontkill, dontkill):
                        if hero == "tesi":
                                middle.collision(tesi)
                        if hero == "gunner":
                                middle.collision(gunner)

                if pygame.sprite.groupcollide(blocks, gassassin, dontkill, dontkill):
                        middle.collision(assassin)

                if assassin.life <= 0:
                        if CHECKMARK1 == 0:
                                msg = "Professor: Incredible, you defeated 'The Assassin'! Yippie!"
                                newText = Text(msg)
                                objects.add(newText)
                                CHECKMARK1 = 1
                                

                shadows.clear(screen, background)
                shadows.update()
                shadows.draw(screen)

                blood.clear(screen, background)
                blood.update()
                blood.draw(screen)
                
                shots.clear(screen, background)
                shots.update()
                shots.draw(screen)

                pshots.clear(screen, background)
                pshots.update()
                pshots.draw(screen)

                ashots.clear(screen, background)
                ashots.update()
                ashots.draw(screen)

                fakeshots.clear(screen, background)
                fakeshots.update()
                fakeshots.draw(screen)
                
                blade.clear(screen, background)
                blade.update()
                blade.draw(screen)
                
                objects.clear(screen, background)
                objects.update()
                objects.draw(screen)

                blocks.clear(screen, background)
                blocks.update()
                blocks.draw(screen)
                
                pygame.display.flip()
Ejemplo n.º 3
0
def StageOne(hero, winstyle = 0):
        
        # Initialize screen
        pygame.init()
        bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32)
        screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth)
        pygame.display.set_caption('Cyborg-Fu!')

        # Creating Background
        bgdtile = load_image('graytile.png')
        background = pygame.Surface(SCREENRECT.size)
        for x in range(0, SCREENRECT.width, bgdtile.get_width()):
                for y in range(0, SCREENRECT.height, bgdtile.get_height()):
                        background.blit(bgdtile, (x, y))

        #Missle & Attack object groups must be determined before characters.
        shots = pygame.sprite.Group()
        pshots = pygame.sprite.Group()
        claws = pygame.sprite.Group()
        blade = pygame.sprite.Group()
        blood = pygame.sprite.Group()
        runties = pygame.sprite.Group()
        
        Runt([100, 100])
        prof = Creature("prof", [740, 30], [1, 1], [10], "still", "prof.png", "nil")

        #Scoreboard
        score = Score()
        scoresprite = pygame.sprite.RenderPlain(score)
                
        #Text
        TEXT = "Professor: Let's see what they can do..."
        text = Text(TEXT)
        textgroup = pygame.sprite.Group()

        #Create Characters
        global gunner
        global tesi
        if hero == "tesi":
                tesi = Tesi(blade)
                life = Life(tesi)
                mana = Mana(tesi)
                lifesprite = pygame.sprite.RenderPlain(life)
                manaSprite = pygame.sprite.RenderPlain(mana)
                heroes = pygame.sprite.Group(tesi)
                sprites = pygame.sprite.Group(tesi, prof, score, life, mana, text)
        if hero == "gunner":
                gunner = Hero(shots)
                life = Life(gunner)
                mana = Mana(gunner)
                lifesprite = pygame.sprite.RenderPlain(life)
                manaSprite = pygame.sprite.RenderPlain(mana)
                heroes = pygame.sprite.Group(gunner)
                sprites = pygame.sprite.Group(gunner, prof, score, life, text)
                
        
        #Assign life values
        Alives = 0
        Blives = 0
        Clives = 0
        Dlives = 0
        Elives = 0
        
        #Checkmarks to avoid repeating text
        CHECKMARK1 = 0
        CHECKMARK2 = 0
        CHECKMARK3 = 0

        all = pygame.sprite.Group(prof, score, life, mana, text, blood, pshots, blade, claws, runties, shots)
        
        #Default groups for each sprite class
        Creature.containers = all
        Shot.containers = all
        PowerShot.containers = all
        Runt.containers = all
        Text.containers = all

        
        # Blit everything to the screen
        screen.blit(background, (0, 0))
        pygame.display.flip()

        # Initialise clock
        clock = pygame.time.Clock()

        #Tesi's blade
        BLADE = 1
        COLLIDELATENCY = 0
        runtreload = RUNT_RELOAD
        
        # Event loop
        while 1:
    
                clock.tick(60)

                COLLIDELATENCY = COLLIDELATENCY - 1

                """Creating actions that cause a change in dialogue"""
                if score.score == 4:
                        if CHECKMARK1 == 0:
                                msg = "Professor: Hmm, they seem to be working properly. Excellent!"
                                newText = Text(msg)
                                sprites.add(newText)
                                CHECKMARK1 = 1

                #I would very much like to get this code condensed, but it doesnt seem possible!
                if runtreload:
                        runtreload = runtreload - 1
                elif not int(random.random() * RUNT_ODDS):
                        choice = random.choice((1,2,3,4,5))
                        if choice == 1:
                                if Alives <= 0:
                                        runtA = Runt([100,50])
                                        runties.add(runtA)
                                        Alives = 1      
                        if choice == 2:
                                if Blives <= 0:
                                        runtB = Runt([200,50])
                                        runties.add(runtB)
                                        Blives = 1      
                        if choice == 3:
                                if Alives <= 0:
                                        runtC = Runt([300,50])
                                        runties.add(runtC)
                                        Clives = 1      
                        if choice == 4:
                                if Dlives <= 0:
                                        runtD = Runt([400,50])
                                        runties.add(runtD)
                                        Dlives = 1      
                        if choice == 5:
                                if Elives <= 0:
                                        runtE = Runt([500,50])
                                        runties.add(runtE)
                                        Elives = 1      
                        
                        runtreload = RUNT_RELOAD

                if hero == "tesi":
                        for event in pygame.event.get():
                                if event.type == QUIT: 
                                        pygame.quit()
                                        return
                                if event.type == KEYDOWN:
                                        if event.key == K_e:
                                                tesi.healing = 1
                                        if event.key == K_SPACE:
                                                if BLADE == 1:
                                                        tesi.throw(blade)
                                                        BLADE = BLADE - 1
                                                        COLLIDELATENCY = 60                                            
                                        if event.key == K_w:
                                                tesi.moveup()
                                        if event.key == K_s:
                                                tesi.movedown()
                                        if event.key == K_a:
                                                tesi.moveleft()
                                        if event.key == K_d:
                                                tesi.moveright()
                                        if event.key == K_l:
                                                if BLADE == 1:
                                                        tesi.swing(blade)
                                                        COLLIDELATENCY = 150
                                elif event.type == KEYUP:
                                        if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
                                                tesi.state = "still"
                                        if event.key == K_e:
                                                tesi.healing = 0

                        # Tesi gets his blade back
                        if COLLIDELATENCY <= 0:
                                if pygame.sprite.spritecollide(tesi, blade, dokill):
                                        BLADE = BLADE + 1

                        if pygame.sprite.spritecollide(tesi, runties, dontkill):
                                tesi.bleed(blood)
                                tesi.life = tesi.life - 3

                if hero == "gunner":
                        for event in pygame.event.get():
                                if event.type == QUIT: 
                                        pygame.quit()
                                        return
                                if event.type == KEYDOWN:
                                        if event.key == K_e:
                                                gunner.powershot(pshots)
                                        if event.key == K_SPACE:
                                                gunner.doublefire(shots)                                            
                                        if event.key == K_w:
                                                gunner.moveup()
                                        if event.key == K_s:
                                                gunner.movedown()
                                        if event.key == K_a:
                                                gunner.moveleft()
                                        if event.key == K_d:
                                                gunner.moveright()
                                elif event.type == KEYUP:
                                        if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
                                                gunner.state = "still"
                    
                        if pygame.sprite.spritecollide(gunner, runties, dontkill):
                                gunner.bleed(blood)
                                gunner.life = gunner.life - 5
                                gunner.knockback()

               

                if Alives == 1:
                        if pygame.sprite.spritecollide(runtA, shots, dokill):
                                runtA.bleed(blood)
                                runtA.life = runtA.life - 10
                                if runtA.life <= 0:
                                        Alives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtA, pshots, dontkill):
                                runtA.bleed(blood)
                                runtA.life = runtA.life - 15
                                if runtA.life <= 0:
                                        Alives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtA, blade, dontkill):
                                runtA.bleed(blood)
                                runtA.life = runtA.life - 4
                                if runtA.life <= 0:
                                        Alives = 0
                                        score.plus(1)
                if Blives == 1:
                        if pygame.sprite.spritecollide(runtB, shots, dokill):
                                runtB.bleed(blood)
                                runtB.life = runtB.life - 10
                                if runtB.life <= 0:
                                        Blives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtB, pshots, dontkill):
                                runtB.bleed(blood)
                                runtB.life = runtB.life - 15
                                if runtB.life <= 0:
                                        Blives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtB, blade, dontkill):
                                runtB.bleed(blood)
                                runtB.life = runtB.life - 4
                                if runtB.life <= 0:
                                        Blives = 0
                                        score.plus(1)
                if Clives == 1:
                        if pygame.sprite.spritecollide(runtC, shots, dokill):
                                runtC.bleed(blood)
                                runtC.life = runtC.life - 10
                                if runtC.life <= 0:
                                        Clives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtC, pshots, dontkill):
                                runtC.bleed(blood)
                                runtC.life = runtC.life - 15
                                if runtC.life <= 0:
                                        Clives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtC, blade, dontkill):
                                runtC.bleed(blood)
                                runtC.life = runtC.life - 4
                                if runtC.life <= 0:
                                        Clives = 0
                                        score.plus(1)
                if Dlives == 1:
                        if pygame.sprite.spritecollide(runtD, shots, dokill):
                                runtD.bleed(blood)
                                runtD.life = runtD.life - 10
                                if runtD.life <= 0:
                                        Dlives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtD, pshots, dontkill):
                                runtD.bleed(blood)
                                runtD.life = runtD.life - 15
                                if runtD.life <= 0:
                                        Dlives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtD, blade, dontkill):
                                runtD.bleed(blood)
                                runtD.life = runtD.life - 4
                                if runtD.life <= 0:
                                        Dlives = 0
                                        score.plus(1)
                if Elives == 1:
                        if pygame.sprite.spritecollide(runtE, shots, dokill):
                                runtE.bleed(blood)
                                runtE.life = runtE.life - 10
                                if runtE.life <= 0:
                                        Elives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtE, pshots, dontkill):
                                runtE.bleed(blood)
                                runtE.life = runtE.life - 15
                                if runtE.life <= 0:
                                        Elives = 0
                                        score.plus(1)
                        if pygame.sprite.spritecollide(runtE, blade, dontkill):
                                runtE.bleed(blood)
                                runtE.life = runtE.life - 4
                                if runtE.life <= 0:
                                        Elives = 0
                                        score.plus(1)

                if pygame.sprite.spritecollide(prof, runties, dontkill):
                        msg = "Professor: (Sigh) Attack the subject, stupid runts!"
                        newText = Text(msg)
                        sprites.add(newText)
                        runties.empty()
                        Alives = 0
                        Blives = 0
                        Clives = 0
                        Dlives = 0
                        Elives = 0

                if pygame.sprite.spritecollide(prof, heroes, dontkill):
                        if score.score <= 9:
                                if CHECKMARK2 == 0:
                                        msg = "Professor: Attack the runts, let me see what you can do!"
                                        newText = Text(msg)
                                        sprites.add(newText)
                                        CHECKMARK2 = 1
                        if score.score >= 10:
                                if CHECKMARK3 == 0:
                                        msg = "I have finally succeeded. I shall call off these runts."
                                        newText = Text(msg)
                                        sprites.add(newText)
                                        CHECKMARK3 = 1
                                        runties.empty()
                                        Alives = 2
                                        Blives = 2
                                        Clives = 2
                                        Dlives = 2
                                        Elives = 2
                                        StageTwo(hero)
                                        
                runties.clear(screen, background)
                runties.update()
                runties.draw(screen)

                blood.clear(screen, background)
                blood.update()
                blood.draw(screen)
                
                shots.clear(screen, background)
                shots.update()
                shots.draw(screen)

                pshots.clear(screen, background)
                pshots.update()
                pshots.draw(screen)
                
                blade.clear(screen, background)
                blade.update()
                blade.draw(screen)

                textgroup.clear(screen, background)
                textgroup.update()
                textgroup.draw(screen)
                
                sprites.clear(screen, background)
                sprites.update()
                sprites.draw(screen)
                
                pygame.display.flip()