Пример #1
0
    def start(self):
        self.hud = loading.Loading(my.ENGINE.screen)

        self.map = map.Map(self.width, self.height, self.seed)
        self.map.generate()

        self.hud.setStatus('Carregando entidades...', 80)
        spawnX = randint(50, self.width - 50)
        self.player = entities.Player(self, self.playerConfigurations[0],
                                      tank.TankDefault(),
                                      (spawnX, self.map.getMaxHeight(spawnX)))
        self.entities = camera.CameraAwareLayeredUpdates(
            self.player, pygame.Rect(0, 0, self.width, self.height))
        self.entities.add(
            self.map
        )  # Adicionando o mapa em entidades para poder ser scrollado
        for i in range(0, self.enemiesCount):
            x = randint(50, self.width - 50)
            self.entities.add(
                entities.Enemy(self, tank.TankDefault(),
                               (x, self.map.getMaxHeight(x))))

        self.hud.setStatus('Carregando interface...', 99)
        self.hud = hud.Hud(self, my.ENGINE.screen)
        my.ENGINE.interface = self.hud
        self.turncontroller = turn.TurnController(self)
        self.turncontroller.start()

        self.wind = wind.Wind(self)

        self.running = True
Пример #2
0
    def __init__(self, application):
        taille_ecran = dic_config["taille_ecran"]
        taille_HUD = dic_config["taille_HUD"]
        taille_personnage = dic_config["taille_personnage"]

        self.environnement = dongeon.Dongeon(
        )  # on initialise le dongeon (1 seul possible)
        self.spawn = self.environnement.get_spawn()  #recuperation du spawn
        self.perso = objet.Personnage(
            self.spawn,
            (taille_personnage, taille_personnage))  #creation du personnage
        self.hud = hud.Hud()  #creation de l'hud
Пример #3
0
 def __init__(self):
     self.pal_control = palette.PaletteControl()
     
     self.screen_shake = screenshake.ScreenShake(self)
     
     self.main_menu = mainmenu.MainMenu(self)
     self.stage = stage.Stage(self, 0)
     self.hud = hud.Hud(self)
     
     self.pal_index = 0
     
     audio.play_music(audio.MUS_TITLE, True)
Пример #4
0
 def __init__(self):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     self.level_manager = state.StateMachine(self, level.Level())
     self.player = player.Player()
     Game.player = self.player
     self.hud_manager = state.StateMachine(
         self, hud.Hud(self, self.player, self.timer))
     self.background = pygame.image.load(
         "data/images/city.png").convert_alpha()
     surface_manager.add(self.player)
     self.music = pygame.mixer.Sound("data/sound/game.wav")
     self.music.play(loops=-1)
Пример #5
0
 def __init__(self):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     self.level_manager = state.StateMachine(self, level.Level())
     self.player = player.Player()
     Game.player = self.player
     self.hud_manager = state.StateMachine(
         self, hud.Hud(self, self.player, self.timer))
     #Loads the background image
     self.background = pygame.image.load(
         "data/images/menu_background.jpg").convert()
     #Adds the player's character to the game window
     surface_manager.add(self.player)
     pygame.display.update
Пример #6
0
 def __init__(self):
     self.timer = pygame.time.Clock()
     self.display = pygame.display.get_surface()
     displayWidth = self.display.get_width()
     displayHeight = self.display.get_height()
     self.player = player.Player()
     Game.player = self.player
     self.level_manager = state.StateMachine(self,level.Level())
     self.hud_manager = state.StateMachine(self, hud.Hud(self, self.player, self.timer))
     self.background = load_image(getGameBackground())
     self.background = pygame.transform.scale(self.background,(displayWidth,displayHeight))
     surface_manager.add(self.player)
     self.player.startGame()
     self.music = load_sound(getGameSound())
     self.music.play(loops=-1)
Пример #7
0
    def __init__(self):

        self.timer = pygame.time.Clock()
        self.display = pygame.display.get_surface()
        self.level_manager = state.StateMachine(self, level.Level())
        self.player = player.Player()
        Game.player = self.player
        self.hud_manager = state.StateMachine(
            self, hud.Hud(self, self.player, self.timer))
        self.background = pygame.image.load(
            'data/images/background_frame2.png')
        surface_manager.add(self.player)

        self.music2 = pygame.mixer.Sound("data/sound/THEME_SONG.wav")
        self.music2.play(loops=-1)
Пример #8
0
Файл: scene.py Проект: aib/MPv2
    def __init__(self, size, midi_handler, debug_camera=False):
        self.size = size
        self.keys = collections.defaultdict(lambda: False)
        self.midi = midi_handler

        self._logger = logging.getLogger(__name__)
        self._deferred_calls = queue.Queue()
        self._next_free_texture = 1
        self.controller = controller.Controller(self, self.midi,
                                                'controls.json',
                                                'channels.txt')
        self.midi.set_controller(self.controller)

        self.set_stereoscopy(STEREOSCOPY_OFF)
        self.stereoscopy_eye_separation = .5

        if debug_camera:
            self.camera = camera.SphericalCamera(
                self,
                target=[0, 0, 0],
                up=[0, 1, 0],
                pos=[0, math.tau / 4, CAMERA_DISTANCE],
                speed=[math.tau / 16, math.tau / 16, 2.],
            )
        else:
            self.camera = camera.WanderingSphericalCamera(
                target=[0, 0, 0],
                up=[0, 1, 0],
                theta_eq=lambda elapsed: (elapsed * math.tau / 499) % math.tau,
                phi_eq=lambda elapsed: math.tau / 4 - math.sin(elapsed / 131) *
                (math.tau / 16),
                r_eq=lambda elapsed: CAMERA_DISTANCE)
        self.fov_y = math.tau / 8

        GL.glClearColor(.1, 0, .1, 1)
        GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
        GL.glEnable(GL.GL_BLEND)
        GL.glEnable(GL.GL_TEXTURE_CUBE_MAP_SEAMLESS)

        GL.glEnable(GL.GL_LINE_SMOOTH)
        GL.glLineWidth(shape.WIREFRAME_LINE_WIDTH)

        try:
            skybox_texture = self.load_texture('texture/skybox.png',
                                               cls=texture.CubeMap)
        except FileNotFoundError:
            skybox_texture = None

        self.skybox = skybox.SkyBox(self, params.DEPTH.MAX / 4, skybox_texture)

        self.shapes = [shape(self) for shape in params.SHAPES]
        self.balls = ball.Balls(
            self, list(map(self.load_texture, glob.glob('texture/ball*.png'))))

        self.max_symmetries = max(
            [max(shape.symmetries.keys()) for shape in self.shapes])
        self._symmetry_map = [None] * self.max_symmetries

        self.hud = hud.Hud(self, (0, 0, size[0], size[1]))

        self.controller.controls['shape'].on_change(
            lambda _, index: self.defer(self._set_shape, index))

        self.controller.initialize_controls()

        now = time.monotonic()
        self.last_update_time = now
def start_game(number_of_players, settings, screen, profiles, user_interface):

    upper_left = (settings.screen_width / 4, settings.screen_height / 4)
    upper_right = (3 * (settings.screen_width / 4), settings.screen_height / 4)
    lower_left = (settings.screen_width / 4, 3 * (settings.screen_height / 4))
    lower_right = (3 * (settings.screen_width / 4),
                   3 * (settings.screen_height / 4))
    ship_spawns = []
    if number_of_players == 1:
        ship_spawns.append(
            (settings.screen_width / 2, settings.screen_height / 2))
    elif number_of_players == 2:
        ship_spawns.append(upper_left)
        ship_spawns.append(lower_right)
    elif number_of_players == 3:
        ship_spawns.append(upper_left)
        ship_spawns.append(lower_right)
        ship_spawns.append(upper_right)
    elif number_of_players == 4:
        ship_spawns.append(upper_left)
        ship_spawns.append(lower_right)
        ship_spawns.append(upper_right)
        ship_spawns.append(lower_left)

    hud_size = (156, 70)
    # TODO these are measured values from the actual game, find a way to adjust these to screen size?
    hud_positions = [(0, 0),
                     (settings.screen_width - hud_size[0],
                      settings.screen_height - hud_size[1]),
                     (settings.screen_width - hud_size[0], 0),
                     (0, settings.screen_height - hud_size[1])]

    ships_group = pygame.sprite.Group()
    level = levels.Level(screen, settings.difficulty, ships_group)

    ships = []
    controls = []
    huds = []
    for i in list(range(0, number_of_players)):
        s = ship.Ship(ship_spawns[i], screen, (31, 31), profiles[i].ship_props,
                      i + 1, level)  # I start counting players from 1
        ships.append(s)
        ships_group.add(s)
        s.spawn()  # TODO move this somewhere else?
        controls.append(profiles[i].control_scheme)
        huds.append(hud.Hud(screen, hud_positions[i], s))

    for s in ships:
        s.enable_friendly_fire(ships_group)

    gf = game_functions.GameFunctions(ships, controls, huds, screen, level)
    clock = pygame.time.Clock()

    # Starting the main game loop
    while True:
        # makes the loop wait a certain amount of time to achieve 60 ticks per s
        clock.tick(60)

        gf.game_loop()
        if gf.game_has_ended:
            user_interface.chosen_number_of_players = -1
            break

        pygame.display.flip(
        )  # makes the most recently drawn frame/screen visible
Пример #10
0
def game():
	import pygame, sys, pygame.mixer
	from pygame.locals import *
	import common_pygame
	import enemy
	import load_resources
	import random
	import ship
	import background
	import hud
	import bonus
	import menu
	import effects
	import particles
	import smoke
	import lasers
	import input
	import lib.eztext 
	import scoreboard

	pygame = common_pygame.pygame
	screen= common_pygame.screen
	clock = common_pygame.clock



	#dictionnaries that will contain all our needed resources
	sounds = dict()
	single_sprites = dict()
	sprite_sequences = dict()

	#create the menu ( we create it here in order to let the menu object read the configuration,
	#to set the correct screen size

	menu=menu.Menu()
	#fill up our dictionnaries
	(sounds, single_sprites, sprite_sequences) = load_resources.load_resources(pygame)

	#sprite proprieties being used later
	laser_height = single_sprites['sprite_laser.png'].get_height()
	laser_width = single_sprites['sprite_laser.png'].get_width()
	#lasershoot_width =  single_sprites['sprite_lasershoot.png'].get_width()
	#lasershoot_height =  single_sprites['sprite_lasershoot.png'].get_height()


	
	#the ship's laser list
	laserlist = list()

	lasershoot = 7

	tinyfont = pygame.font.Font(None, 16)
	font = pygame.font.Font(None,32)
	font2 = pygame.font.Font(None, 150)

	background = background.BackGen(single_sprites)



	hud= hud.Hud(single_sprites, menu, sounds)
	#start the menu
	menu.init2(single_sprites, sounds, background, hud)
	menu.launch(0)


	ship = ship.Ship(single_sprites, sounds, menu, sprite_sequences )
	ship.setWeapon(1)

	ship_top = screen.get_height()-ship.height
	ship_left = screen.get_width()/2 - ship.width/2

	decal_laser_ship_x = (ship.width /2)
	coord_laser_ship_y = -40
	
	
	#the enemy laser system
	lasers = lasers.Lasers(single_sprites, ship)

	enemy_list = list()

	compteur = 0
	countdown=0
	#to know if it's ok to shoot
	compteur_shoot=int(0)
	nbAsteroids=0
	#current_sprite=0

	it=0

	#bonus processing
	scoreBonus=bonus.Bonus(sounds, menu)

	thegame=True
	level =-1
	spawnedBoss=False
	while thegame:
		compteur_shoot=compteur_shoot+1
		
		#every 2 minutes, level up
		if compteur%(30*60)==0:
			level=level+1
		#level 1 : 3 enemies every 3 seconds
		if level==1:
			if compteur%(3*20)==0:
				
				boolrand = bool(random.getrandbits(1))
				for i in range(1):
					enemy_list.append(enemy.Enemy( single_sprites, sprite_sequences , sounds,
					i*80+250+60*int(boolrand), -single_sprites['sprite_enemy.png'].get_height(),boolrand \
					, 0, menu))
				#print (enemy_list[0].nbAsteroids)
		if level==2:
			if compteur%(2*60)==0:
				
				boolrand = bool(random.getrandbits(1))
				for i in range(6):
					enemy_list.append(enemy.Enemy( single_sprites, sprite_sequences , sounds,
					i*80+190+60*int(boolrand), -single_sprites['sprite_enemy.png'].get_height(),boolrand \
					, 0, menu))
				#print (enemy_list[0].nbAsteroids)
		if level==3 and not spawnedBoss:
			enemy_list.append(enemy.Enemy( single_sprites, sprite_sequences , sounds, 
			400-single_sprites['boss1.png'].get_width()/2, -single_sprites['boss1.png'].get_height(),1 ,\
			 2, menu))
			spawnedBoss=True
			#if compteur%(1*60)==0:
				
				#boolrand = bool(random.getrandbits(1))
				#for i in range(9):
					#enemy_list.append(enemy.Enemy( single_sprites, sprite_sequences , sounds,
					#i*80+80+60*int(boolrand), -single_sprites['sprite_enemy.png'].get_height(),boolrand , 0, menu))
				#print (enemy_list[0].nbAsteroids)
				
		#new asteroids
		#if ((len(enemy_list)==0) or enemy_list[0].nbAsteroids<=2) and compteur%150==0:
		if compteur%150==0:
			boolrand = bool(random.getrandbits(1))
			enemy_list.append(enemy.Enemy( single_sprites, sprite_sequences , sounds,
				random.randrange(0, screen.get_width()), -32,boolrand , 1, menu))
			enemy_list[0].nbAsteroids=enemy_list[0].nbAsteroids+1
			#if (len(enemy_list)>=0):
				#print(
				
		compteur = compteur +1 
		background.updatecompteur()
		
		
		clock.tick_busy_loop(30)
		screen.fill((0,0,0))

		#blit the stars and the asteroids
		background.blitStars()
		background.blitPlanets()
			#show the fog
		background.blitFog()

		
		mouse_x,mouse_y=pygame.mouse.get_pos()
		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				sys.exit()
			#elif event.type == MOUSEBUTTONDOWN:
				#sounds['laser.wav'].play()
				#laserlist.append( (ship.position_ship_x+ship.width/2 -laser_width/2 ,
				#ship.position_ship_y-laser_height))
				#lasershoot = 7
		if pygame.key.get_pressed()[K_ESCAPE]:
			#launch menu with resume option
			menu.launch(1) 				
		if pygame.key.get_pressed()[K_LEFT]:
			if ship.currentspeed_x >=0:
				ship.currentspeed_x = -5
			if ship.currentspeed_x > -20:
				ship.currentspeed_x = ship.currentspeed_x -1
			
		elif pygame.key.get_pressed()[K_RIGHT]:
			if ship.currentspeed_x <= 0:
				ship.currentspeed_x = 5
			if ship.currentspeed_x < 20:
				ship.currentspeed_x = ship.currentspeed_x +1
		if pygame.key.get_pressed()[K_DOWN]:
			if ship.currentspeed_y <= 0:
				ship.currentspeed_y = 5
			if ship.currentspeed_y < 20:
				ship.currentspeed_y = ship.currentspeed_y +1
		elif pygame.key.get_pressed()[K_UP]:
			if ship.currentspeed_y >= 0:
				ship.currentspeed_y = -5
			if ship.currentspeed_y > -20:
				ship.currentspeed_y = ship.currentspeed_y -1
		
		if 	pygame.key.get_pressed()[K_LEFT] ==0 and pygame.key.get_pressed()[K_RIGHT]==0 \
		and pygame.key.get_pressed()[K_UP] ==0 and pygame.key.get_pressed()[K_DOWN]==0:
			ship.currentspeed_y=0
			ship.currentspeed_x=0
		
		
		#are we shooting ?
		if pygame.key.get_pressed()[K_SPACE]:
			(compteur_shoot, laserlist) =ship.shoot(laserlist,compteur_shoot, laser_width, laser_height)
			
					
		#update the ships position
		ship.updatePosition()
		#blit the right thing
		ship.blit(compteur)
				
		
		
		#blit the laser shot fire
		#if lasershoot >= 0 :
			#screen.blit(single_sprites['sprite_lasershoot.png'],(ship.position_ship_x+ship.width/2 -lasershoot_width/2,
			 #ship.position_ship_y ))
			#lasershoot = lasershoot -1
			
		oldLasers = list()	
		#blit the lasers
		for index in range(len(laserlist)):
			(currentx, currenty, lasertype) = laserlist[index]
			if currenty>=-40:
				#it's a normal laser
				if lasertype==1:
					screen.blit(single_sprites['sprite_laser_light.png'],(currentx-29-32,currenty-22-32))
					screen.blit(single_sprites['sprite_laser.png'],(currentx,currenty))
					currenty = currenty - 15
				#it's a plasma ball
				else :
					screen.blit(single_sprites['ball1_light.png'],(currentx-10,currenty-10))
					screen.blit(single_sprites['ball1.png'],(currentx,currenty))
					currenty = currenty - 20				
				
				laserlist[index]=(currentx,currenty, lasertype)
			else:
				oldLasers.append((currentx,currenty, lasertype))
		#purge old lasers
		for index in range(len(oldLasers)):
			laserlist.remove(oldLasers[index])
			
		deadEnemies=list()
		#blit and process the enemies
		for index in range(len(enemy_list)):
			oldLasers=enemy_list[index].processHit(laserlist, ship)
			enemy_list[index].update(ship, lasers)
			if enemy_list[index].alive==False:
				deadEnemies.append(enemy_list[index])
				#purge old lasers
			for index in range(len(oldLasers)):
				laserlist.remove(oldLasers[index])	
			
		#purge dead enemies
		for index in range(len(deadEnemies)):
			enemy_list.remove(deadEnemies[index])	
		
		
		#blit and process the enemy's lasers
		lasers.update()
		
		
		
				
		#blit the hud		
		level = hud.blit(ship, level)
				
		#process ship hurt
		countdown = ship.processHurt(countdown)

		if (ship.life<=0):
			thegame=False
			#youlost = font2.render("Game over", True, (255,255, 255))
			#presskey = font.render("press any key to quit", True, (255,255, 255))
			#yourscore = font.render("Your score : "+ str(ship.score), True, (255,255, 255))
			youlost = pygame.font.Font("BITSUMIS.TTF",105).render("Game over", True, (255,255, 255))
			presskey = pygame.font.Font("BITSUMIS.TTF",23).render("press escape to quit", True, (255,255, 255))
			yourscore = pygame.font.Font("BITSUMIS.TTF",30).render("Your score : "+ str(ship.score), True, (255,255, 255))
			
			yourname = pygame.font.Font("BITSUMIS.TTF",55).render("Your name : ", True, (255,255, 255))
			
			#play a the explosion sound
			menu.play_sound(sounds['explosion2.wav'])
			#blit the explosion
			screen.blit(sprite_sequences['sprite_explosion_list_asteroid.png'][3],\
			 (ship.position_ship_x-64,ship.position_ship_y-64))
			#fade to red
			effects.fadeToColor(255, 0, 0)
		#scoreBonus.ProcessBonus(ship)
		particles.blitAndUpdate()
		smoke.blitAndUpdate()
		
		pygame.display.flip()

	exitloop = True
	exitcountdown =0
	name = ""
	car = ""
	txtbx = lib.eztext.Input(maxlength=45, color=(255,50,50), prompt='Your name: ')
	txtbx.set_pos( 230,180)
	txtbx.set_font(pygame.font.Font("BITSUMIS.TTF",30))
	nametyped = False
	scoreObj = scoreboard.ScoreBoard()
	
	while exitloop:
		exitcountdown =exitcountdown+ 1
		clock.tick_busy_loop(30)
		screen.fill((0,0,0))
		
		background.updatecompteur()
		background.blitStars()
		background.blitPlanets()
		#show the fog
		background.blitFog()
		screen.blit(youlost, (110,35 ))
		screen.blit(yourscore, (130,150 ))
		#screen.blit(yourname, (180,330 ))
		#screen.blit(pygame.font.Font("BITSUMIS.TTF",55)\
		#.render(name, True, (255,0, 0)), (300, 330))
		screen.blit(presskey, (270,520 ))
		
		#car = str(input.keyInput())
		#if isinstance(car, str):
			#name = name + pygame.key.name(car)
		#print("name : " + name)
		#input.keyInput()
		
		if not nametyped:
			# update txtbx
			txtbx.update(pygame.event.get())
        
        # blit txtbx on the sceen
		#if exitcountdown%20>10:
				#txtbx.draw(screen)
		
		if txtbx.hasTyped() ==False:
			if exitcountdown%20>10:
				txtbx.draw(screen)
		elif nametyped == False:
			txtbx.draw(screen)
		
		
		if exitcountdown==30:
			menu.play_sound(sounds["loser.wav"])
			
		if exitcountdown>=30:
			for event in pygame.event.get():
				if event.type == pygame.QUIT:
					sys.exit()
			if pygame.key.get_pressed()[K_ESCAPE]:
				print("exiting")
				exit()
				exitloop=False
			if pygame.key.get_pressed()[K_RETURN]:
				if not nametyped:
					scoreObj.addScore(ship.score, txtbx.getText())
					nametyped = True
				
 
		scoreObj.printScore()

				

		#if pygame.KEYDOWN:
			#print("exiting")
			#exit()
		pygame.display.flip()
Пример #11
0
def start(jukebox, level, first_time=False):
    menu = False
    if level == "menu.txt":
        menu = True
    next_level = None
    pygame.display.set_caption("Moon's moons")
    screen = pygame.display.set_mode(
        (SCREEN.WIDTH, SCREEN.HEIGHT))  #, pygame.FULLSCREEN)
    if first_time and level in STORY:
        story(screen, STORY[level])
    dim = screen.copy().convert_alpha()
    dim.fill((0, 0, 0, 200))
    screen_rect = screen.get_rect()
    background = data.load_image('background.png')

    img_dict = data.load_images()
    overlay = hud.Hud(SCREEN.WIDTH, SCREEN.HEIGHT, img_dict)
    pl, planets, platforms, checkpoints, monsters, boosters, stars, bullets, ports, stables, parts, settings = load_level(
        level)
    last_checkpoint = checkpoints.pop(0).circle.center
    cam = camera.Camera(pl)
    pl.set_camera(cam)
    decaying = []
    star_counter = 0
    tries = 1
    buttons = []
    buttons.append(
        button.Button(750, 50, 'esc', data.load_image('cross.png', True),
                      data.load_image('cross_over.png', True)))
    buttons.append(
        button.Button(680, 50, 'sound', data.load_image('sound.png', True),
                      data.load_image('sound_over.png', True)))
    for c in checkpoints:
        c.update_angle(planets)
    for p in ports:
        p.update_angle(planets)
    jukebox.play_song(settings['song'])
    running = True
    start_time = last_time = pygame.time.get_ticks()
    clock = pygame.time.Clock()
    shown = False
    slowed = False
    won = False
    while running:
        clock.tick(100)
        for e in pygame.event.get():
            if e.type == pygame.QUIT:
                running = False
            if e.type == pygame.KEYDOWN and e.key == pygame.K_ESCAPE:
                running = False
            if e.type == pygame.KEYDOWN and e.key == pygame.K_r:
                pl.respawn(last_checkpoint)
            if e.type == pygame.KEYDOWN and e.key == pygame.K_e:
                if shown:
                    shown = False
                else:
                    shown = True
            if e.type == pygame.KEYDOWN and e.key == pygame.K_s:
                if slowed:
                    slowed = False
                else:
                    slowed = True
        time = pygame.time.get_ticks()
        delta = time - last_time
        if slowed:
            delta /= 10
        if delta > 300:
            delta = delta % 300
        external = [0, 0]
        for b in boosters:
            external = sum(external, b.get_force(pl))
        state = pl.update(pygame.key.get_pressed(), delta, external)
        if state == 'dead':
            pl.respawn(last_checkpoint)
            tries += 1
        for m in monsters:
            if settings['update_all']:
                m.update(delta)
            else:
                if m.has_line:
                    point = m.line.start
                else:
                    point = m.circle.center
                if cam.rect.collidepoint(point):
                    m.update(delta)
        for b in bullets:
            b.update(delta)
        for b in boosters:
            b.update(delta)

        cam.update()
        last_time = time

        screen_rect.x = cam.x / 10 + SCREEN.WIDTH / 2
        screen_rect.y = cam.y / 10 + SCREEN.HEIGHT / 2
        screen.blit(background, (0, 0), screen_rect)
        for ds in decaying:
            if ds.update(pl, delta):
                decaying.remove(ds)
            show(ds, screen, cam)
        for s in stars:
            if s.update(pl, delta):
                star_counter += 1
                decaying.append(stars.pop(stars.index(s)))
            show(s, screen, cam)
        for p in parts:
            if p.update(pl, delta):
                decaying.append(parts.pop(parts.index(p)))
            show(p, screen, cam)
            if shown:
                pygame.draw.circle(screen, (150, 150, 150),
                                   cam.shift(p.circle.center), p.circle.radius)

        bullets[:] = [
            b for b in bullets if cam.rect.collidepoint(b.circle.center)
        ]
        blen = len(bullets) - 1
        for b in range(len(bullets)):
            c = False
            for p in planets:
                if p.circle.collide_circle(bullets[blen - b].circle):
                    c = True
                    break
            if not c:
                for p in platforms:
                    if p.line.collide_circle(bullets[blen - b].circle,
                                             PLATFORM.BORDER):
                        c = True
                        break
            if c:
                del bullets[blen - b]
        blen = len(bullets) - 1
        for b in range(len(bullets)):
            if bullets[blen - b].circle.collide_circle(pl.circle):
                pl.respawn(last_checkpoint)
                tries += 1
                del bullets[blen - b]

        ##########################
        ######### DRAW ###########
        ##########################
        for s in stables:
            show(s, screen, cam)
        for p in ports:
            show(p, screen, cam)
            if len(parts) == 0 and p.circle.collide_circle(pl.circle):
                next_level = p.level
                running = False
                won = True
        for b in boosters:
            show(b, screen, cam)
        for c in checkpoints:
            if c.circle.collide_circle(
                    pl.circle) and last_checkpoint != c.circle.center:
                last_checkpoint = c.circle.center
                for cp in checkpoints:
                    cp.uncap()
                c.cap()
            c.update(delta)
            screen.blit(
                c.image,
                (c.image_position[0] - cam.x, c.image_position[1] - cam.y))
        for b in bullets:
            show(b, screen, cam)
        for m in monsters:
            kill = False
            if m.has_line:
                if m.line.collide_circle(pl.circle, m.border):
                    kill = True
            else:
                if m.circle.collide_circle(pl.circle):
                    kill = True
            if kill:
                pl.respawn(last_checkpoint)
                tries += 1
            show(m, screen, cam)
            if shown:
                if m.has_line:
                    pygame.draw.line(screen, (150, 50, 255),
                                     cam.shift(m.line.start),
                                     cam.shift(m.line.end), m.border * 2)
                else:
                    pygame.draw.circle(screen, (150, 50, 255),
                                       cam.shift(m.circle.center),
                                       m.circle.radius)
        show(pl, screen, cam)
        if shown:
            pygame.draw.circle(screen, (150, 50, 255),
                               cam.shift(pl.circle.center), pl.circle.radius)
        for p in planets:
            show(p, screen, cam)
            if shown:
                pygame.draw.circle(screen, (50, 150, 255),
                                   cam.shift(p.circle.center), p.circle.radius)
        for p in platforms:
            screen.blit(
                p.image,
                (p.image_position[0] - cam.x, p.image_position[1] - cam.y))
        for b in buttons:
            e = b.update()
            if e == 'esc':
                running = False
            elif e == 'sound':
                jukebox.toggle()
            screen.blit(b.image, b.image_position)

        if not menu:
            overlay.update(delta, star_counter, tries)
            screen.blit(overlay.image, (0, 0))
        if shown:
            screen.blit(dim, (0, 0))
        pygame.display.flip()
    if not menu:
        if won:
            data.save_level(star_counter, tries, level)
        else:
            data.save_level(0, 0, level)
    return next_level