diff --git a/Code/Config.py b/Code/Config.py index 7b8a9fe..a5f1084 100644 --- a/Code/Config.py +++ b/Code/Config.py @@ -3,6 +3,7 @@ class GeneralConfig: height = 1000 fps = 150 window_caption = "GOL" + evolve_speed= 360# ziemlich slow das updated abhänig davon wie viele mill sec das game seit dem eltzten mal gelaufen ist im schnit sind das so 60 class Colors: ORANGE = (255, 140, 0) diff --git a/Code/GameLogic/Rules.py b/Code/GameLogic/Rules.py index 034ffa2..0bda99a 100644 --- a/Code/GameLogic/Rules.py +++ b/Code/GameLogic/Rules.py @@ -53,7 +53,7 @@ class Rules: start = time.time() field_new = Field() end = time.time() - print(end - start) + #print(end - start) index_x = 0 index_y = 0 diff --git a/Code/UI/PlayingField.py b/Code/UI/PlayingField.py index e4c1ad8..6aca658 100644 --- a/Code/UI/PlayingField.py +++ b/Code/UI/PlayingField.py @@ -23,7 +23,6 @@ class GameState: self.update_field_events.append(event) if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: - self.update_field_events.append(event) self.pause_for_input = not self.pause_for_input def update_field_with_input(self, event): @@ -51,23 +50,24 @@ def run_game(): time_elapsed_since_last_action = 0 while game_state.run: game_state.event_handler() - print(len(game_state.update_field_events)) + for event in game_state.update_field_events: game_state.update_field_with_input(event) game_state.update_field_events.remove(event) - print("running") + clock.tick(GeneralConfig.fps) - time_elapsed_since_last_action += clock.tick() + time_elapsed_since_last_action += clock.get_time() if game_state.pause_for_input: - if time_elapsed_since_last_action > 1: - start = ti.time() + if time_elapsed_since_last_action > 100: + + #start = ti.time() game_state.evolve() - end = ti.time() - print(end - start) + #end = ti.time() + #print(end - start) time_elapsed_since_last_action = 0 # reset it to 0 so you can count again game_state.redraw_field(window)