def update(self, entity, interval): # distx = Globals.PLAYER.posx - entity.posx # disty = Globals.PLAYER.posy - entity.posy # dist = math.sqrt(distx * distx + disty * disty) # if dist <= 50: if not Globals.PLAYER is None and\ pygame.sprite.collide_rect(entity, Globals.PLAYER): entity.kill() Globals.MINI_SUNS = Globals.MINI_SUNS + 1 Globals.MINI_SUNS_INLVL = Globals.MINI_SUNS_INLVL + 1 Globals.SCORE = Globals.SCORE + 1000 sunID = Globals.sunPos()[(entity.rect.x, entity.rect.y)] Globals.sunTr()[sunID] = False
def deadScreen(self): ImageManager.unloadSet("debug") AudioManager.unloadSfxSet("debug") World.cleanupCompletely() Globals.PLAYER = None pygame.mixer.music.stop() if Globals.MINI_SUNS_INLVL > 0: Globals.MINI_SUNS = Globals.MINI_SUNS - 1 Globals.SCORE = Globals.SCORE - 1000*Globals.MINI_SUNS_INLVL if Globals.CURRENT_LEVEL != "five": pickCount = random.randint(1, 10) index = 0 if Globals.MINI_SUNS_INLVL > 0: # remove sun code while pickCount > 0: index = (index + 1) % 5 if Globals.sunTr()[index]: continue pickCount -= 1 Globals.SUN_TRACKER[Globals.CURRENT_LEVEL][index] = True # Globals.SUN_TRACKER[Globals.CURRENT_LEVEL] = self.sunArray Globals.STATE = OverScreen.OverScreen() Globals.MINI_SUNS_INLVL = 0