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

Fixed initializing facing point of player

parent 72d1ce99
No related branches found
No related tags found
1 merge request!21Resolve "Mark counter to interact with"
......@@ -375,6 +375,7 @@ class Environment:
del self.free_positions[free_idx]
else:
log.debug("No free positions left in kitchens")
player.update_facing_point()
def detect_collision_world_bounds(self, player: Player):
"""Checks for detections of the player and the world bounds.
......
......@@ -50,7 +50,7 @@ class Player:
] = None # needed to stop progress when moved away
self.current_nearest_counter: Optional[Counter] = None
self.facing_point: npt.NDArray[float] = np.array(self.pos)
self.facing_point: npt.NDArray[float] = np.zeros([0, 0], float)
def move(self, movement: npt.NDArray[float]):
"""Moves the player position by the given movement vector.
......@@ -81,6 +81,9 @@ class Player:
"""
if np.linalg.norm(direction) != 0:
self.facing_direction = direction / np.linalg.norm(direction)
self.update_facing_point()
def update_facing_point(self):
self.facing_point = self.pos + (
self.facing_direction * self.radius * self.grid_size * 0.5
)
......
......@@ -280,7 +280,7 @@ class PyGameGUI:
self.counter_size,
self.counter_size,
),
width=1,
width=2,
)
def draw_thing(
......
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