예제 #1
0
    def __init__(self):
        self.game = GameLogic()

        sdl2.ext.init()
        self.window = sdl2.ext.Window("War Game",
                                      size=(self.WIDTH, self.HEIGHT))
        self.window.show()

        self.world = sdl2.ext.World()

        self.spriterenderer = SoftwareRenderer(self.window)
        self.world.add_system(self.spriterenderer)

        self.factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)

        self.countries = []
        country_count = len(self.game.countries)

        # Load countries
        for i, c in enumerate(self.game.countries):
            perc = (math.sin(i * TAU / country_count) / 2 + 1 / 2)
            x = (0.1 + 0.8 * perc) * self.WIDTH

            perc = (math.cos(i * TAU / country_count) / 2 + 1 / 2)
            y = (0.1 + 0.8 * perc) * self.HEIGHT

            self.countries.append(Player(self.world, self.factory, x, y))
예제 #2
0
    def __init__(self, window: pygame.Surface):
        self.game = GameLogic()
        self.window = window
        self.clock = pygame.time.Clock()
        self.active_weapons = ActiveWeapons()
        self.explosions = Explosions()
        self.particles = Particles()
        self.timer = time.time()
        self.end_game = None

        self.countries = Countries(self.game.countries.countries, self.WIDTH,
                                   self.HEIGHT)
예제 #3
0
    def __init__(self, window: pygame.Surface):
        self.end_game = None
        self.fullscreen = False
        self.window = window

        self.game = GameLogic()
        self.clock = pygame.time.Clock()
        self.active_weapons = ActiveWeapons()
        self.explosions = Explosions()
        self.lasers = Lasers()
        self.particles = Particles()
        self.shake = Shake()
        self.timer = time.time()

        self.countries = Countries(self.game.countries.countries, SIZE)
예제 #4
0
 def __init__(self):
     self.game = GameLogic()