forked from PatrickKalkman/python-galaga
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSR_main.py
More file actions
39 lines (32 loc) · 902 Bytes
/
Copy pathSR_main.py
File metadata and controls
39 lines (32 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
import pygame
import multiprocessing
from states.menu import Menu
from states.gameplay import Gameplay
from states.game_over import GameOver
from states.splash import Splash
from game import Game
import constants
def run_game():
pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT))
states = {
"GAMEPLAY": Gameplay(True, "human"),
"GAME_OVER": GameOver(),
}
game = Game(screen, states, "GAMEPLAY")
game.run()
pygame.quit()
sys.exit()
if __name__ == "__main__":
multiprocessing.set_start_method("spawn")
num_games = 20
processes = []
for _ in range(num_games):
p = multiprocessing.Process(target=run_game)
p.start()
processes.append(p)
for p in processes:
p.join()