예제 #1
0
class SceneController(object):
    def __init__(self):
        self.__scene = MenuScene(self)

    def render(self, screen):
        return self.__scene.render(screen)

    def handle_events(self, events):
        # Handle global events
        for event in events:
            if event.type == KEYDOWN:
                self.handle_keydown(event)

        # Pass remaining events to scene
        self.__scene.handle_events(events)

    def handle_keydown(self, event):
        if event.key == K_ESCAPE:
            pyEvent.post(pyEvent.Event(QUIT))

    def update(self, ms):
        # Time-based updates
        # self.scene.update(ms)
        self.__scene.update(ms)

    def get_scene(self):
        return self.__scene

    def set_scene(self, scene):
        self.__scene = scene
예제 #2
0
def switch_scene():
    if change == "menu":
        return MenuScene(game_window)
    if change == "waiting_scene":
        return WaitingScene(game_window)
    if change == "game":
        return MultiGameScene(game_window)
    if change == "login":
        return LoginScene(game_window)
    if change == "account":
        return AccountScene(game_window)
    if change == "stats":
        return StatsScene(game_window)
    if change == "history":
        return HistoryScene(game_window)
    if change == "settings":
        return SettingScene(game_window)
    if change == "server_scene":
        return ServerScene(game_window)
    if change == "single_or_multi_scene":
        return SingleOrMultiScene(game_window)
    if change == "change_pass":
        return ChangeScene(game_window)
    if change == "game_over_scene":
        return GameOverScene(game_window)
    if change == "single_menu":
        return SingleGameScene(game_window)
예제 #3
0
# 1. Init pygame
pygame.init()

# 2. Set screen
SIZE = (800, 620)
canvas = pygame.display.set_mode(SIZE)

# 3. Clock
clock = pygame.time.Clock()

loop = True

generate_map("image/map/map.json")

menu_scene = MenuScene()
global_scene_manager.change_scene(menu_scene)

# guide_scene = GuideScene()
# global_scene_manager.change_scene(guide_scene)
# player = Player(32, 320, input_manager)
# enemy = Enemy(368, 608)
# enemy1 = Enemy(640, 300)
#
# black_slave = BlackSlave(768, 240)
# black_screen = BlackScreen(0, 0)
# main_door = MainDoor(16, 320)
#
# game_objects.add(enemy)
# game_objects.add(black_slave)
# game_objects.add(main_door)
예제 #4
0
 def __init__(self):
     self.__scene = MenuScene(self)