Skip to content
Snippets Groups Projects
Commit 7b893d7b authored by Fabian Heinrich's avatar Fabian Heinrich
Browse files

New image for showing which buttons to press to continue

parent 3bbc6584
No related branches found
No related tags found
1 merge request!62Resolve "Game Flow"
Pipeline #46991 passed
overcooked_simulator/gui_2d_vis/continue.drawio.png

644 KiB

...@@ -437,18 +437,18 @@ class PyGameGUI: ...@@ -437,18 +437,18 @@ class PyGameGUI:
) )
img = pygame.image.load( img = pygame.image.load(
ROOT_DIR / "gui_2d_vis" / "press_a.drawio.png" ROOT_DIR / "gui_2d_vis" / "continue.drawio.png"
).convert_alpha() ).convert_alpha()
image_rect = img.get_rect() image_rect = img.get_rect()
image_rect.centery += 60 image_rect.centery += 80
self.press_a_image = pygame_gui.elements.UIImage( self.press_a_image = pygame_gui.elements.UIImage(
image_rect, image_rect,
img, img,
manager=self.manager, manager=self.manager,
anchors={"centerx": "centerx", "centery": "centery"}, anchors={"centerx": "centerx", "centery": "centery"},
) )
img_width = self.buttons_width img_width = self.buttons_width * 1.5
img_height = img_width * (image_rect.height / image_rect.width) img_height = img_width * (image_rect.height / image_rect.width)
new_dims = (img_width, img_height) new_dims = (img_width, img_height)
self.press_a_image.set_dimensions(new_dims) self.press_a_image.set_dimensions(new_dims)
...@@ -467,7 +467,7 @@ class PyGameGUI: ...@@ -467,7 +467,7 @@ class PyGameGUI:
(0, 0), (0, 0),
( (
self.window_width * 0.9, self.window_width * 0.9,
(self.window_height // 3), (self.window_height // 4),
), ),
) )
player_selection_rect.bottom = -10 player_selection_rect.bottom = -10
...@@ -803,7 +803,7 @@ class PyGameGUI: ...@@ -803,7 +803,7 @@ class PyGameGUI:
self.tutorial_image, self.tutorial_image,
self.quit_button, self.quit_button,
self.continue_button, self.continue_button,
self.fullscreen_button self.fullscreen_button,
] ]
self.pregame_screen_elements = [ self.pregame_screen_elements = [
...@@ -826,8 +826,7 @@ class PyGameGUI: ...@@ -826,8 +826,7 @@ class PyGameGUI:
self.conclusion_label, self.conclusion_label,
self.quit_button, self.quit_button,
self.next_game_button, self.next_game_button,
self.finish_study_button self.finish_study_button,
] ]
self.end_screen_elements = [ self.end_screen_elements = [
...@@ -865,7 +864,6 @@ class PyGameGUI: ...@@ -865,7 +864,6 @@ class PyGameGUI:
if self.CONNECT_WITH_STUDY_SERVER: if self.CONNECT_WITH_STUDY_SERVER:
self.bot_number_container.hide() self.bot_number_container.hide()
self.update_selection_elements() self.update_selection_elements()
case MenuStates.ControllerTutorial: case MenuStates.ControllerTutorial:
self.show_screen_elements(self.tutorial_screen_elements) self.show_screen_elements(self.tutorial_screen_elements)
...@@ -1083,7 +1081,6 @@ class PyGameGUI: ...@@ -1083,7 +1081,6 @@ class PyGameGUI:
self.player_ids = [str(list(self.player_info.keys())[0])] self.player_ids = [str(list(self.player_info.keys())[0])]
def get_game_connection(self, tutorial): def get_game_connection(self, tutorial):
if self.menu_state == MenuStates.ControllerTutorial: if self.menu_state == MenuStates.ControllerTutorial:
self.player_info = requests.post( self.player_info = requests.post(
f"http://localhost:8080/connect_to_tutorial/{self.participant_id}" f"http://localhost:8080/connect_to_tutorial/{self.participant_id}"
...@@ -1185,8 +1182,6 @@ class PyGameGUI: ...@@ -1185,8 +1182,6 @@ class PyGameGUI:
self.state_player_id = player_id self.state_player_id = player_id
def setup_game(self, tutorial=False): def setup_game(self, tutorial=False):
if self.CONNECT_WITH_STUDY_SERVER: if self.CONNECT_WITH_STUDY_SERVER:
self.get_game_connection(tutorial) self.get_game_connection(tutorial)
else: else:
...@@ -1422,7 +1417,6 @@ class PyGameGUI: ...@@ -1422,7 +1417,6 @@ class PyGameGUI:
case self.continue_button: case self.continue_button:
self.exit_tutorial() self.exit_tutorial()
############################################ ############################################
case MenuStates.PreGame: case MenuStates.PreGame:
...@@ -1518,7 +1512,17 @@ class PyGameGUI: ...@@ -1518,7 +1512,17 @@ class PyGameGUI:
# Press key instead of mouse button press # Press key instead of mouse button press
if ( if (
event.type == pygame.JOYBUTTONDOWN and any([self.joysticks and self.joysticks[i].get_button(7) for i in range(len(self.joysticks))]) or event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN event.type == pygame.JOYBUTTONDOWN
and any(
[
self.joysticks and self.joysticks[i].get_button(7)
for i in range(len(self.joysticks))
]
)
or (
event.type == pygame.KEYDOWN
and event.key == pygame.K_RETURN
)
): ):
match self.menu_state: match self.menu_state:
case MenuStates.Start: case MenuStates.Start:
...@@ -1586,7 +1590,6 @@ class PyGameGUI: ...@@ -1586,7 +1590,6 @@ class PyGameGUI:
self.disconnect_websockets() self.disconnect_websockets()
def main( def main(
url: str, url: str,
port: int, port: int,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment