From d86f8c360b9626ded05396edcd81ccca12058e80 Mon Sep 17 00:00:00 2001 From: SpagettiFisch <63868515+SpagettiFisch@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:31:01 +0100 Subject: [PATCH] fixed bug which stopped movement if colliding with projectiles Signed-off-by: SpagettiFisch <63868515+SpagettiFisch@users.noreply.github.com> --- main.py | 4 ++-- viecher.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e2920b6..52140eb 100644 --- a/main.py +++ b/main.py @@ -57,7 +57,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): screen.blit(bg, (0, 0)) """ for thing in objects[0]: - if not thing.update(pygame.key.get_pressed()): + if not thing.update(pygame.key.get_pressed(), objects): menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) thing.draw(screen) @@ -170,7 +170,7 @@ def main(): #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) - test(screen, clock, running, background, isblack, WIDTH, HEIGHT) + #test(screen, clock, running, background, isblack, WIDTH, HEIGHT) menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) """while running: for event in pygame.event.get(): diff --git a/viecher.py b/viecher.py index 162fff4..c80ca16 100644 --- a/viecher.py +++ b/viecher.py @@ -108,7 +108,7 @@ class MainCharacter(Fighter): self.x += moveto[0] / fps self.y += moveto[1] / fps touches = pg.sprite.spritecollideany(self, objects[1] + objects[2]) - if touches is not None: + if touches is not None and not isinstance(touches, Weapons): self.x -= moveto[0] / fps #change later self.y -= moveto[1] / fps #change later