コード例 #1
0
 def setUp(self):
     self.game = Game((100, 100), 0, 1, [('w', 0)], "",
                      [Asteroid(50, 50, 0, 0, 10, 100, 100)])
     self.game.shots.append(Shot(self.game.player, 100, 100))
     self.game.shots[0].x = 50
     self.game.shots[0].y = 50
     self.game.player.x = 0
     self.game.player.y = 0
コード例 #2
0
 def add_random_asteroid(self, asteroids_count: int):
     for i in range(asteroids_count):
         self.asteroids.append(
             Asteroid(int(self.window_width * random.random()),
                      int(self.window_height * random.random()),
                      6 * (random.random() - 0.5),
                      6 * (random.random() - 0.5),
                      12 + int(25 * random.random()), self.window_width,
                      self.window_height))
コード例 #3
0
 def create_random_asteroid(self, asteroid: Asteroid):
     return Asteroid(asteroid.x, asteroid.y,
                     asteroid.speed_x + 6 * (random.random() - 0.5),
                     asteroid.speed_y + 6 * (random.random() - 0.5), 10,
                     self.window_width, self.window_height)
コード例 #4
0
 def setUp(self):
     self.game = Game((100, 100), 0, 1, [('w', 0)], "",
                      [Asteroid(0, 0, 0, 0, 10, 100, 100)])
コード例 #5
0
 def setUp(self):
     self.game = Game((100, 100), 0, 1,
                      [('w', 1), ('w', 1), ('w', 1), ('w', 1),
                       ('w', 1)],
                      "s",
                      [Asteroid(50, 50, 0, 0, 80, 100, 100)])
コード例 #6
0
 def setUp(self):
     self.game = Game((100, 100), 0, 1, [('w', 0)], "",
                      [Asteroid(50, 50, 0, 0, 10, 100, 100)])
     self.shot = Shot(self.game.player, 100, 100)
     self.X = self.shot.x