From 4535d43dfe8ed01c9d79d734a228eebc5675ea4b Mon Sep 17 00:00:00 2001 From: DasMoorhuhn Date: Thu, 12 Dec 2024 20:24:09 +0100 Subject: [PATCH] fix update position bug --- vpet.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/vpet.py b/vpet.py index 07aedc0..2c03f07 100644 --- a/vpet.py +++ b/vpet.py @@ -122,7 +122,7 @@ class Activity: class VPet: - def __init__(self, move, pos, draw, x=0, y=40, screen=1): + def __init__(self, move, pos, draw, x=0, y=100, screen=1): self.screen = screen self.pos = pos self.x_postion = x @@ -139,13 +139,16 @@ class VPet: def action_loop(self): # print(f'Interacting with user: {self.activity.is_interacting_with_user}') + self.update_position() + print(self.x_postion, self.y_postion) if self.activity.is_interacting_with_user: return + self.x_postion = self.pos().x() + 3 self.draw(self.frames.idle_1) - self.move(self.x_postion, self.y_postion + 100) - self.x_postion = self.pos().x() + 1 - - if self.activity.is_sleeping: - pass + self.move(self.x_postion, self.y_postion) + + def update_position(self): + self.x_postion = self.pos().x() + self.y_postion = self.pos().y() def choose_walk_destination(self): """Decide, where the VPet should move to"""