上传文件至 '计分'
This commit is contained in:
parent
e31fe70aeb
commit
7c53360308
|
@ -0,0 +1,45 @@
|
|||
# This is a sample Python script.
|
||||
|
||||
# Press Shift+F10 to execute it or replace it with your code.
|
||||
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
|
||||
|
||||
|
||||
def print_hi(name):
|
||||
# Use a breakpoint in the code line below to debug your script.
|
||||
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
|
||||
|
||||
|
||||
# Press the green button in the gutter to run the script.
|
||||
if __name__ == '__main__':
|
||||
print_hi('PyCharm')
|
||||
|
||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
||||
import pygame.sysfont
|
||||
from pygame.sprite import Group
|
||||
from ship import Ship
|
||||
|
||||
|
||||
class Scoreboard():
|
||||
|
||||
def __init__(self, ai_settings, screen, stats):
|
||||
self.screen = screen
|
||||
self.screen_rect = screen.get_rect()
|
||||
self.ai_settings = ai_settings
|
||||
self.stats = stats
|
||||
|
||||
self.text_color = (30, 30, 30)
|
||||
self.font = pygame.font.SysFont(None, 32)
|
||||
|
||||
self.prep_score()
|
||||
self.prep_high_score()
|
||||
self.prep_level()
|
||||
self.prep_ships()
|
||||
|
||||
|
||||
def prep_ships(self):
|
||||
self.ships = Group()
|
||||
for ship_number in range(self.stats.ships_left):
|
||||
ship = Ship(self.ai_settings, self.screen)
|
||||
ship.rect.x = 10 + ship_number * ship.rect1.width
|
||||
ship.rect.y = 530
|
||||
self.ships.add(ship)
|
Loading…
Reference in New Issue