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

Use same size parameter for both window scaling methods,

fixed position of items held by the player in gui
parent f1c2ef52
No related branches found
No related tags found
1 merge request!25Resolve "Positions based on grid not pixels"
Pipeline #42990 passed
......@@ -104,18 +104,14 @@ class PyGameGUI:
self.visualization_config = yaml.safe_load(file)
if self.visualization_config["GameWindow"]["WhatIsFixed"] == "window_width":
self.window_width = self.visualization_config["GameWindow"][
"FixedWindowWidth"
]
self.window_width = self.visualization_config["GameWindow"]["size"]
kitchen_aspect_ratio = (
simulator.env.kitchen_height / simulator.env.kitchen_width
)
self.window_height = int(self.window_width * kitchen_aspect_ratio)
self.grid_size = int(self.window_width / simulator.env.kitchen_width)
elif self.visualization_config["GameWindow"]["WhatIsFixed"] == "grid":
self.grid_size = self.visualization_config["GameWindow"][
"KitchenGridSizePixels"
]
self.grid_size = self.visualization_config["GameWindow"]["size"]
self.window_width, self.window_height = (
simulator.env.kitchen_width * self.grid_size,
simulator.env.kitchen_height * self.grid_size,
......@@ -282,7 +278,9 @@ class PyGameGUI:
)
if player.holding is not None:
holding_item_pos = player.pos + (20 * player.facing_direction)
holding_item_pos = (player.pos * self.grid_size) + (
20 * player.facing_direction
)
self.draw_item(holding_item_pos, player.holding)
if player.current_nearest_counter:
......
......@@ -2,8 +2,7 @@
GameWindow:
WhatIsFixed: window_width # entweder grid oder window_width
KitchenGridSizePixels: 30
FixedWindowWidth: 800
size: 600
Kitchen:
ground_tiles_color: sgigray76
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment