From: Skullheadx <704277@pdsb.net> Date: Mon, 11 Jul 2022 06:22:34 +0000 (-0400) Subject: player faces vel when run X-Git-Url: http://git.skullheadx.com/nixos/static/index.html?a=commitdiff_plain;h=600acb7510b1a588676f1cbd79049d25f736ad01;p=Pygame-Jam.git player faces vel when run --- diff --git a/Player.py b/Player.py index 7b3df32..d737219 100644 --- a/Player.py +++ b/Player.py @@ -139,23 +139,25 @@ class Player(Actor): self.state = "IDLE" elif self.state == "RUN": frame = math.floor(self.current_frame) - if self.direction == 1: + # if self.direction == 1: + if self.velocity.x > 0: self.display = self.run_frames[math.floor(frame)] self.display_offsets["player"] = pg.Vector2(-40, -35) - elif self.direction == -1: + # elif self.direction == -1: + elif self.velocity.x < 0: self.display = pg.transform.flip(self.run_frames[math.floor(frame)], True, False) self.display_offsets["player"] = pg.Vector2(-65, -35) - else: - self.direction = prev_direction - if prev_direction == 1: - self.display_offsets["player"] = pg.Vector2(-40, -35) - - self.display = self.run_frames[math.floor(frame)] - elif prev_direction == -1: - self.display = pg.transform.flip(self.run_frames[math.floor(frame)], True, False) - self.display_offsets["player"] = pg.Vector2(-65, -35) + # else: + # self.direction = prev_direction + # if prev_direction == 1: + # self.display_offsets["player"] = pg.Vector2(-40, -35) + # + # self.display = self.run_frames[math.floor(frame)] + # elif prev_direction == -1: + # self.display = pg.transform.flip(self.run_frames[math.floor(frame)], True, False) + # self.display_offsets["player"] = pg.Vector2(-65, -35) self.current_frame = (self.current_frame + 1) % self.run_gif.n_frames