コード例 #1
0
 def add_ship(self, pos=None, cargo=None):
     if pos:
         pos = pos
     else:
         pos = (random.randint(100, self.rect.w - 100),
                   random.randint(100, self.rect.h - 100))
     start_angle = random.uniform(0, math.pi * 2)
     parts = random.choice(self.ai_ship_choices)
     ai_ship.AIShip(pos, start_angle, products.make_ship(parts), cargo, self.ai_ships)
コード例 #2
0
 def __init__(self):
     """
     This is the main class that runs the program.
     """
     self.screen = pg.display.get_surface()
     self.screen_rect = self.screen.get_rect()
     self.clock = pg.time.Clock()
     self.fps = 60
     self.keys = pg.key.get_pressed()
     self.done = False
     self.player = actors.Player((0,0), 0, products.make_ship(prepare.PLAYER_DEFAULT), None)
     self.level = level.Level(self.screen_rect.copy(), self.player)