コード例 #1
0
 def kill(self):
     if self.die_time <= 0:
         self.image = pygame.Surface((1, 1))
         self.image.set_alpha(0)
         #            self.dead = True
         data.stop_music()
         self.die_time = 200
コード例 #2
0
ファイル: game.py プロジェクト: BradyZhou/15-112
 def playerdie(self):
     data.stop_music()
     if len(self.death) == 0:
         self.lives -= 1
         if self.lives >= 0:
             pygame.time.wait(2000)
             self.flagged = 0
             self.redo()
         else:
             if len(self.character) == 0:
                 pygame.time.wait(2000)
                 self.gameOver()
コード例 #3
0
 def playerdie(self):
     data.stop_music()
     if len(self.death) == 0:
         self.lives -= 1
         if self.lives >= 0:
             pygame.time.wait(2000)
             self.flagged = 0
             self.redo()
         else:
             if len(self.character) == 0:
                 pygame.time.wait(2000)
                 self.gameOver()
コード例 #4
0
ファイル: game.py プロジェクト: BradyZhou/15-112
    def main_loop(self):
        while self.start:
            if not self.paused:
                self.clock.tick(60)
                self.camera.update()

                # for guy in self.character:
                #     guy.update()

                #########################################
                # HANDLES NO CLIPPING TOGGLING
                #########################################
                if self.cheat_enabled:
                    self.player.no_clip = 1
                    self.player.clear_collisions()
                else:
                    self.player.no_clip = 0

                #########################################
                # DEALS WITH NO CLIP INVICIBILITY
                #########################################
                if self.record == 'konami' and not self.chill and self.lvl != 9:
                    print 'C H E A T    E N A B L E D'
                    self.cheat_enabled = 1
                    self.chill = 1
                    data.stop_music()
                    data.play_music('winner.wav')

                if self.lvl == 9 and self.cheat_enabled:
                    self.cheat_enabled = 0
                    print 'C H E A T    D I S A B L E D'
                    print 'You no longer need to cheat. You cannot die in this sanctuary.'

                #########################################
                # FIX FOR MULTIPLE DYING SOUNDS, DYING IN GENERAL
                #########################################
                if self.flagged:
                    if self.diefix == 0:
                        die = data.load_sound('die.wav')
                        die.play()
                        self.diefix += 1
                    self.playerdie()

                #########################################
                # PRECAUTION IF FLAG DOES NOT CATCH YOU FOR SOME REASON
                #########################################
                if self.player.rect.right > self.level.size:
                    self.player.rect.right = self.level.size

                #########################################
                # KILLS YOU/SAVES YOU IF YOU FALL
                #########################################
                if self.player.rect.top > 460 and not self.player.invuln:
                    self.player.life -= 1
                    self.flagged = 1
                    self.playerdie()
                elif self.player.rect.bottom > 460 and self.player.invuln and not self.cheat_enabled:
                    self.player.rect.bottom = 460
                    self.player.save = 1

                #########################################
                # HANDLES INVULNERABILITY
                #########################################
                for toon in self.sprites:
                    toon.update()
                    if not self.cheat_enabled:
                        if self.player.invuln:
                            self.player.timer += 1
                            if self.player.timer > 250000:
                                self.player.invuln = 0
                                self.player.timer = 0
                                self.player.save = 0

                #########################################
                # CANNOT LOSE VICTORY LEVEL
                #########################################
                if self.lvl == 9 or self.cheat_enabled:
                    self.player.invuln = 1

                for platform in self.platforms:
                    platform.update()

                if self.player.no_clip != 1:
                    self.player.collide(self.platforms)

                for banner in self.flags:
                    banner.update()
                    if self.player.rect.centerx >= banner.rect.centerx and self.lvl !=9:
                        pygame.mixer.music.stop()
                        self.complete.play()
                        self.score += 460-self.player.rect.bottom
                        self.finish()
                    elif self.player.rect.centerx >= banner.rect.centerx:
                        self.score += 1000
                        self.win_game()


                #########################################
                # HANDLES CANNON FIRING
                #########################################
                for weapon in self.cannons:
                    if abs(weapon.rect.centerx-self.player.rect.centerx) < 400:
                        if self.player.rect.centerx < weapon.rect.centerx:
                            weapon.chance()

                #########################################
                # COIN EXTRACTION
                #########################################
                for block in self.coinquestions:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                #########################################
                # HANDLES BULLET BILLS
                #########################################
                for bomb in self.missles:
                    if (bomb.rect.left - 20 < self.player.rect.centerx < bomb.rect.right + 20) and (0 < bomb.rect.top-self.player.rect.bottom < 5):
                            self.score += 245
                            self.player.up = -6
                            GrabCoin((bomb.rect.left,bomb.rect.top))
                            bomb.kill()
                            self.player.rect.bottom = bomb.rect.top-1
                    elif self.player.rect.colliderect(bomb.rect):
                        if self.player.invuln:
                            self.score += 20
                            GrabCoin((bomb.rect.left,bomb.rect.top))
                            bomb.kill()
                        else:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()
                    bomb.update()

                #########################################
                # HANDLES BOWSER FIRE AND FLARES
                #########################################
                for heat in self.fire:
                    heat.update()
                    if self.player.rect.colliderect(heat.rect):
                        if self.player.invuln != 1:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()
                        else:
                            heat.kill()

                for flare in self.flares:
                    if self.player.rect.colliderect(flare.rect):
                        if self.player.invuln:
                            flare.kill()
                        else:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()

                #########################################
                # HANDLES QUESTIONBLOCK EXTRACTION
                #########################################
                for block in self.upplat:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                for block in self.brickquestions:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                for block in self.starquestions:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                #########################################
                # HANDLES BRICK DEMOLITION
                #########################################
                for block in self.breakable:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        if self.player.breaker == 1:
                            block.bing()
                        if block.hits >= 9:
                            block.kill()
                            self.score += 10

                #########################################
                # HANDLES MUSHROOMS
                #########################################
                for shroom in self.mushrooms:
                    shroom.update()
                    shroom.collide(self.platforms)
                    if self.player.rect.colliderect(shroom.rect):
                        shroom.kill()
                        self.power.play()
                        if shroom.name == 'brick':
                            self.player.breaker = 1
                            self.score += 45
                            #self.player.magic()
                        if shroom.name == 'life':
                            self.lives += 1
                            self.score += 30
                        GrabShroom(shroom.rect.topleft,shroom.name)

                #########################################  
                # HANDLES STARS
                #########################################
                for star in self.powerup:
                    star.update()
                    if self.player.rect.colliderect(star.rect):
                        star.kill()
                        self.power.play()
                        if self.player.invuln == 0:
                            self.player.invuln = 1
                        GrabShroom(star.rect.topleft,star.name)

                #########################################
                # HANDLES COINS
                #########################################
                for coin in self.coins:
                    if self.player.rect.colliderect(coin.rect):
                        coin.kill()
                        self.score += 50
                        self.coinsound.play()
                        GrabCoin(coin.rect.topleft)

                #########################################
                # HANDLES SPIKES
                #########################################
                for dagger in self.hazards:
                    if self.player.rect.colliderect(dagger.rect):
                        if self.player.invuln != 1:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()
                        else:
                            dagger.kill()

                #########################################
                # HANDLES ENEMY COLLISIONS AND BOWSER BEHAVIOR
                #########################################
                for enemy in self.enemies:
                    enemy.update()
                    enemy.collide(self.stationary)
                    if enemy.name == 'Bowser':
                        if self.player.rect.centerx+3000 >= enemy.x:
                            if self.player.rect.right - enemy.rect.left < -75:
                                enemy.play((self.player.rect.right,self.player.rect.top))
                            elif self.player.rect.right - enemy.rect.left > -75:
                                enemy.defeat()
                        if self.player.rect.colliderect(enemy.rect):
                            if not self.player.invuln:
                                self.player.life -=1
                                self.flagged = 1
                                self.playerdie()
                    if enemy.name != 'Bowser':
                        if (enemy.rect.left - 17 < self.player.rect.centerx < enemy.rect.right + 17) and (0 < enemy.rect.top-self.player.rect.bottom < 8):
                            if enemy.name == 'Goomba':
                                self.score += 100
                            if enemy.name == 'RedKoopa':
                                self.score += 195
                            if enemy.name == 'GreenKoopa':
                                self.score += 165
                            self.player.up = -6
                            enemy.flag()
                            self.player.rect.bottom = enemy.rect.top-1
                        elif self.player.rect.colliderect(enemy.rect):
                            if self.player.invuln:
                                self.score += 20
                                enemy.flag()
                            else:
                                if self.player.breaker == 0:
                                    self.player.life -= 1
                                    self.flagged = 1
                                    self.playerdie()
                                else:
                                    enemy.flag()
                                    self.player.rect.bottom = enemy.rect.top-1
                                    self.player.breaker = 0
                                    #self.player.magic()

                #########################################
                # HANDLES BOWSER SWITCH KILLER
                #########################################
                for operator in self.switches:
                    if self.player.rect.bottom == operator.rect.top and (operator.rect.left-16 < self.player.rect.centerx < operator.rect.right+16):
                        for piece in self.bridges:
                            piece.kill()
                            for enemy in self.enemies:
                                if enemy.name == 'Bowser':
                                    enemy.die()
                    if self.player.rect.centerx > operator.rect.right:
                        for piece in self.bridges:
                            piece.kill()
                        for enemy in self.enemies:
                            if enemy.name == 'Bowser':
                                enemy.die()
                    if self.player.rect.left > operator.rect.right+50 and operator.dead == 0:
                        x = operator.x
                        y = operator.y
                        for mult in xrange(0,8):
                            CastleBrick((x,y-32*mult),None)
                        win = data.load_sound('break.wav',1)
                        win.play()
                        self.score += 500
                        operator.dead += 1

                #########################################
                # HANDLES PLANTS
                #########################################
                for venus in self.traps:
                    venus.update()
                    venus.collide(self.bases)
                    if self.player.rect.colliderect(venus.rect):
                        die = data.load_sound('stomp.wav',1)
                        if self.player.invuln:
                            venus.die()
                        else:
                            if self.player.breaker == 0:
                                self.player.life -= 1
                                self.flagged = 1
                                self.playerdie()
                            else:
                                self.player.breaker = 0
                                venus.die()

                #########################################
                # HANDLES EVENTS AND CHEAT CODES
                #########################################
                events = pygame.event.get()
                for event in events:
                    if event.type == QUIT:
                        sys.exit()
                        return
                    if event.type == KEYDOWN:
                        if event.key == K_ESCAPE:
                            self.paused = 1
                        if event.key == K_SPACE:
                            if not self.player.no_clip:
                                self.player.jump()
                        if self.record == '':
                            if event.key == K_k:
                                self.record += 'k'
                        if event.key == K_o and self.record == 'k':
                            self.record += 'o'
                        if event.key == K_n and self.record == 'ko':
                            self.record += 'n'
                        if event.key == K_a and self.record == 'kon':
                            self.record += 'a'
                        if event.key == K_m and self.record == 'kona':
                            self.record += 'm'
                        if event.key == K_i and self.record == 'konam':
                            self.record += 'i'
                        if self.record == 'konami':
                            if event.key == K_BACKQUOTE:
                                okay = 1
                                for sprite in self.platforms:
                                    if self.player.rect.colliderect(sprite.rect):
                                        okay = 0
                                if okay:
                                    self.record = ''
                                    self.chill = 0
                                    self.cheat_enabled = 0
                                    self.player.invuln = 0
                                    print 'C H E A T    D I S A B L E D'
                                    data.stop_music()
                                    data.play_music(self.bgcolor[self.lvl][1])
                                else:
                                    print 'This is not a valid location to turn on clipping!'

            #########################################
            # HANDLES SCREEN CREATION
            #########################################
            if not self.paused:
                self.screen.blit(self.bg, ((-self.camera.rect.x/1)%640, 0))
                self.screen.blit(self.bg, ((-self.camera.rect.x/1)%640 + 640, 0))
                self.screen.blit(self.bg, ((-self.camera.rect.x/1)%640 - 640, 0))
                self.camera.create_world(self.screen, self.sprites)
                self.info()
                pygame.display.flip()

            #########################################
            # HANDLES PAUSE SCREEN
            #########################################
            elif self.paused and not self.saving:
                events = pygame.event.get()
                pause = data.load_image('pausescreen.png',1)
                self.screen.blit(pause,(0,0))
                self.menu.create(self.screen)
                self.menu.choose(events)
                text = self.font.render('NOTE :',1,(255,0,0))
                self.screen.blit(text,(320-text.get_width()/2,360))
                text = self.font.render('If you quit without saving,',1,(255,255,255))
                self.screen.blit(text,(320-text.get_width()/2,390))
                text = self.font.render('your progress will be lost.',1,(255,255,255))
                self.screen.blit(text,(320-text.get_width()/2,420))
                for event in events:
                    if event.type == QUIT:
                        sys.exit()
                        return
                    if event.type == KEYDOWN:
                        if event.key == K_ESCAPE:
                            self.paused = 0
                pygame.display.flip()

            #########################################
            # HANDLES SAVES ETC.
            #########################################
            elif self.paused and self.saving:
                events = pygame.event.get()
                save = data.load_image('save.bmp',1)
                self.screen.blit(save,(0,0))
                saves = Savefile().read()
                if saves == []:
                    self.menu2.create(self.screen)
                    self.menu2.choose(events)
                else:
                    self.menu3.create(self.screen)
                    self.menu3.choose(events)
                for event in events:
                    if event.type == QUIT:
                        sys.exit()
                        return
                    if event.type == KEYDOWN:
                        if event.key == K_ESCAPE:
                            self.saving = 0
                pygame.display.flip()

            if self.lvl == 9:
                if self.player.rect.top < 100:
                    self.player.save = 0
コード例 #5
0
    def main_loop(self):
        while self.start:
            if not self.paused:
                self.clock.tick(60)
                self.camera.update()

                # for guy in self.character:
                #     guy.update()

                #########################################
                # HANDLES NO CLIPPING TOGGLING
                #########################################
                if self.cheat_enabled:
                    self.player.no_clip = 1
                    self.player.clear_collisions()
                else:
                    self.player.no_clip = 0

                #########################################
                # DEALS WITH NO CLIP INVICIBILITY
                #########################################
                if self.record == 'konami' and not self.chill and self.lvl != 9:
                    print 'C H E A T    E N A B L E D'
                    self.cheat_enabled = 1
                    self.chill = 1
                    data.stop_music()
                    data.play_music('winner.wav')

                if self.lvl == 9 and self.cheat_enabled:
                    self.cheat_enabled = 0
                    print 'C H E A T    D I S A B L E D'
                    print 'You no longer need to cheat. You cannot die in this sanctuary.'

                #########################################
                # FIX FOR MULTIPLE DYING SOUNDS, DYING IN GENERAL
                #########################################
                if self.flagged:
                    if self.diefix == 0:
                        die = data.load_sound('die.wav')
                        die.play()
                        self.diefix += 1
                    self.playerdie()

                #########################################
                # PRECAUTION IF FLAG DOES NOT CATCH YOU FOR SOME REASON
                #########################################
                if self.player.rect.right > self.level.size:
                    self.player.rect.right = self.level.size

                #########################################
                # KILLS YOU/SAVES YOU IF YOU FALL
                #########################################
                if self.player.rect.top > 460 and not self.player.invuln:
                    self.player.life -= 1
                    self.flagged = 1
                    self.playerdie()
                elif self.player.rect.bottom > 460 and self.player.invuln and not self.cheat_enabled:
                    self.player.rect.bottom = 460
                    self.player.save = 1

                #########################################
                # HANDLES INVULNERABILITY
                #########################################
                for toon in self.sprites:
                    toon.update()
                    if not self.cheat_enabled:
                        if self.player.invuln:
                            self.player.timer += 1
                            if self.player.timer > 250000:
                                self.player.invuln = 0
                                self.player.timer = 0
                                self.player.save = 0

                #########################################
                # CANNOT LOSE VICTORY LEVEL
                #########################################
                if self.lvl == 9 or self.cheat_enabled:
                    self.player.invuln = 1

                for platform in self.platforms:
                    platform.update()

                if self.player.no_clip != 1:
                    self.player.collide(self.platforms)

                for banner in self.flags:
                    banner.update()
                    if self.player.rect.centerx >= banner.rect.centerx and self.lvl !=9:
                        pygame.mixer.music.stop()
                        self.complete.play()
                        self.score += 460-self.player.rect.bottom
                        self.finish()
                    elif self.player.rect.centerx >= banner.rect.centerx:
                        self.score += 1000
                        self.win_game()


                #########################################
                # HANDLES CANNON FIRING
                #########################################
                for weapon in self.cannons:
                    if abs(weapon.rect.centerx-self.player.rect.centerx) < 400:
                        if self.player.rect.centerx < weapon.rect.centerx:
                            weapon.chance()

                #########################################
                # COIN EXTRACTION
                #########################################
                for block in self.coinquestions:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                #########################################
                # HANDLES BULLET BILLS
                #########################################
                for bomb in self.missles:
                    if (bomb.rect.left - 20 < self.player.rect.centerx < bomb.rect.right + 20) and (0 < bomb.rect.top-self.player.rect.bottom < 5):
                            self.score += 245
                            self.player.up = -6
                            GrabCoin((bomb.rect.left,bomb.rect.top))
                            bomb.kill()
                            self.player.rect.bottom = bomb.rect.top-1
                    elif self.player.rect.colliderect(bomb.rect):
                        if self.player.invuln:
                            self.score += 20
                            GrabCoin((bomb.rect.left,bomb.rect.top))
                            bomb.kill()
                        else:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()
                    bomb.update()

                #########################################
                # HANDLES BOWSER FIRE AND FLARES
                #########################################
                for heat in self.fire:
                    heat.update()
                    if self.player.rect.colliderect(heat.rect):
                        if self.player.invuln != 1:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()
                        else:
                            heat.kill()

                for flare in self.flares:
                    if self.player.rect.colliderect(flare.rect):
                        if self.player.invuln:
                            flare.kill()
                        else:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()

                #########################################
                # HANDLES QUESTIONBLOCK EXTRACTION
                #########################################
                for block in self.upplat:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                for block in self.brickquestions:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                for block in self.starquestions:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        block.bing()

                #########################################
                # HANDLES BRICK DEMOLITION
                #########################################
                for block in self.breakable:
                    if block.rect.bottom == self.player.rect.top and (block.rect.left-15 < self.player.rect.centerx < block.rect.right+15):
                        if self.player.breaker == 1:
                            block.bing()
                        if block.hits >= 9:
                            block.kill()
                            self.score += 10

                #########################################
                # HANDLES MUSHROOMS
                #########################################
                for shroom in self.mushrooms:
                    shroom.update()
                    shroom.collide(self.platforms)
                    if self.player.rect.colliderect(shroom.rect):
                        shroom.kill()
                        self.power.play()
                        if shroom.name == 'brick':
                            self.player.breaker = 1
                            self.score += 45
                            #self.player.magic()
                        if shroom.name == 'life':
                            self.lives += 1
                            self.score += 30
                        GrabShroom(shroom.rect.topleft,shroom.name)

                #########################################
                # HANDLES STARS
                #########################################
                for star in self.powerup:
                    star.update()
                    if self.player.rect.colliderect(star.rect):
                        star.kill()
                        self.power.play()
                        if self.player.invuln == 0:
                            self.player.invuln = 1
                        GrabShroom(star.rect.topleft,star.name)

                #########################################
                # HANDLES COINS
                #########################################
                for coin in self.coins:
                    if self.player.rect.colliderect(coin.rect):
                        coin.kill()
                        self.score += 50
                        self.coinsound.play()
                        GrabCoin(coin.rect.topleft)

                #########################################
                # HANDLES SPIKES
                #########################################
                for dagger in self.hazards:
                    if self.player.rect.colliderect(dagger.rect):
                        if self.player.invuln != 1:
                            self.player.life -= 1
                            self.flagged = 1
                            self.playerdie()
                        else:
                            dagger.kill()

                #########################################
                # HANDLES ENEMY COLLISIONS AND BOWSER BEHAVIOR
                #########################################
                for enemy in self.enemies:
                    enemy.update()
                    enemy.collide(self.stationary)
                    if enemy.name == 'Bowser':
                        if self.player.rect.centerx+3000 >= enemy.x:
                            if self.player.rect.right - enemy.rect.left < -75:
                                enemy.play((self.player.rect.right,self.player.rect.top))
                            elif self.player.rect.right - enemy.rect.left > -75:
                                enemy.defeat()
                        if self.player.rect.colliderect(enemy.rect):
                            if not self.player.invuln:
                                self.player.life -=1
                                self.flagged = 1
                                self.playerdie()
                    if enemy.name != 'Bowser':
                        if (enemy.rect.left - 17 < self.player.rect.centerx < enemy.rect.right + 17) and (0 < enemy.rect.top-self.player.rect.bottom < 8):
                            if enemy.name == 'Goomba':
                                self.score += 100
                            if enemy.name == 'RedKoopa':
                                self.score += 195
                            if enemy.name == 'GreenKoopa':
                                self.score += 165
                            self.player.up = -6
                            enemy.flag()
                            self.player.rect.bottom = enemy.rect.top-1
                        elif self.player.rect.colliderect(enemy.rect):
                            if self.player.invuln:
                                self.score += 20
                                enemy.flag()
                            else:
                                if self.player.breaker == 0:
                                    self.player.life -= 1
                                    self.flagged = 1
                                    self.playerdie()
                                else:
                                    enemy.flag()
                                    self.player.rect.bottom = enemy.rect.top-1
                                    self.player.breaker = 0
                                    #self.player.magic()

                #########################################
                # HANDLES BOWSER SWITCH KILLER
                #########################################
                for operator in self.switches:
                    if self.player.rect.bottom == operator.rect.top and (operator.rect.left-16 < self.player.rect.centerx < operator.rect.right+16):
                        for piece in self.bridges:
                            piece.kill()
                            for enemy in self.enemies:
                                if enemy.name == 'Bowser':
                                    enemy.die()
                    if self.player.rect.centerx > operator.rect.right:
                        for piece in self.bridges:
                            piece.kill()
                        for enemy in self.enemies:
                            if enemy.name == 'Bowser':
                                enemy.die()
                    if self.player.rect.left > operator.rect.right+50 and operator.dead == 0:
                        x = operator.x
                        y = operator.y
                        for mult in xrange(0,8):
                            CastleBrick((x,y-32*mult),None)
                        win = data.load_sound('break.wav',1)
                        win.play()
                        self.score += 500
                        operator.dead += 1

                #########################################
                # HANDLES PLANTS
                #########################################
                for venus in self.traps:
                    venus.update()
                    venus.collide(self.bases)
                    if self.player.rect.colliderect(venus.rect):
                        die = data.load_sound('stomp.wav',1)
                        if self.player.invuln:
                            venus.die()
                        else:
                            if self.player.breaker == 0:
                                self.player.life -= 1
                                self.flagged = 1
                                self.playerdie()
                            else:
                                self.player.breaker = 0
                                venus.die()

                #########################################
                # HANDLES EVENTS AND CHEAT CODES
                #########################################
                events = pygame.event.get()
                for event in events:
                    if event.type == QUIT:
                        sys.exit()
                        return
                    if event.type == KEYDOWN:
                        if event.key == K_ESCAPE:
                            self.paused = 1
                        if event.key == K_SPACE:
                            if not self.player.no_clip:
                                self.player.jump()
                        if self.record == '':
                            if event.key == K_k:
                                self.record += 'k'
                        if event.key == K_o and self.record == 'k':
                            self.record += 'o'
                        if event.key == K_n and self.record == 'ko':
                            self.record += 'n'
                        if event.key == K_a and self.record == 'kon':
                            self.record += 'a'
                        if event.key == K_m and self.record == 'kona':
                            self.record += 'm'
                        if event.key == K_i and self.record == 'konam':
                            self.record += 'i'
                        if self.record == 'konami':
                            if event.key == K_BACKQUOTE:
                                okay = 1
                                for sprite in self.platforms:
                                    if self.player.rect.colliderect(sprite.rect):
                                        okay = 0
                                if okay:
                                    self.record = ''
                                    self.chill = 0
                                    self.cheat_enabled = 0
                                    self.player.invuln = 0
                                    print 'C H E A T    D I S A B L E D'
                                    data.stop_music()
                                    data.play_music(self.bgcolor[self.lvl][1])
                                else:
                                    print 'This is not a valid location to turn on clipping!'

            #########################################
            # HANDLES SCREEN CREATION
            #########################################
            if not self.paused:
                self.screen.blit(self.bg, ((-self.camera.rect.x/1)%640, 0))
                self.screen.blit(self.bg, ((-self.camera.rect.x/1)%640 + 640, 0))
                self.screen.blit(self.bg, ((-self.camera.rect.x/1)%640 - 640, 0))
                self.camera.create_world(self.screen, self.sprites)
                self.info()
                pygame.display.flip()

            #########################################
            # HANDLES PAUSE SCREEN
            #########################################
            elif self.paused and not self.saving:
                events = pygame.event.get()
                pause = data.load_image('pausescreen.png',1)
                self.screen.blit(pause,(0,0))
                self.menu.create(self.screen)
                self.menu.choose(events)
                text = self.font.render('NOTE :',1,(255,0,0))
                self.screen.blit(text,(320-text.get_width()/2,360))
                text = self.font.render('If you quit without saving,',1,(255,255,255))
                self.screen.blit(text,(320-text.get_width()/2,390))
                text = self.font.render('your progress will be lost.',1,(255,255,255))
                self.screen.blit(text,(320-text.get_width()/2,420))
                for event in events:
                    if event.type == QUIT:
                        sys.exit()
                        return
                    if event.type == KEYDOWN:
                        if event.key == K_ESCAPE:
                            self.paused = 0
                pygame.display.flip()

            #########################################
            # HANDLES SAVES ETC.
            #########################################
            elif self.paused and self.saving:
                events = pygame.event.get()
                save = data.load_image('save.bmp',1)
                self.screen.blit(save,(0,0))
                saves = Savefile().read()
                if saves == []:
                    self.menu2.create(self.screen)
                    self.menu2.choose(events)
                else:
                    self.menu3.create(self.screen)
                    self.menu3.choose(events)
                for event in events:
                    if event.type == QUIT:
                        sys.exit()
                        return
                    if event.type == KEYDOWN:
                        if event.key == K_ESCAPE:
                            self.saving = 0
                pygame.display.flip()

            if self.lvl == 9:
                if self.player.rect.top < 100:
                    self.player.save = 0