Collisions fixed #58

Merged
Spafi merged 3 commits from Spafi/game:main into Development 2024-03-04 17:18:33 +01:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit d86f8c360b - Show all commits

View file

@ -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():

View file

@ -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