Esempio n. 1
0
     title = titlefont.render("ASTEROIDS" , 1, pygame.color.THECOLORS['white'])
     screen.blit(title, (130, 100))
     pygame.display.update()
 if mode == 'play':
     keys = pygame.key.get_pressed()
     if keys[pygame.K_LEFT]:
         spaceship.rotate("left")
     if keys[pygame.K_RIGHT]:
         spaceship.rotate("right")
     if keys[pygame.K_SPACE] and shot_counter > 9:
         laser = Laser(spaceship.spaceship_direction,spaceship.spaceship_x,spaceship.spaceship_y)
         lasers.append(laser)
         shot_counter = 0
         laser_sound.play()
     if keys[pygame.K_UP]:
          spaceship.booster()
          rocket_sound.play()
     if keys[pygame.K_SLASH] and special > .5 and shot_counter > 9:
         special = special - 1
         shot_counter = 0
         bullet_spray()    
    
     shot_counter = shot_counter + 1
         
     #doing / movement / collisions
     for asteroid in asteroid_list:
         asteroid.move_asteroid()
     spaceship.move()
     
     for laser in lasers:
         laser.move()