forked from InfoProjekt/game
fixed bug which stopped movement if colliding with projectiles
Signed-off-by: SpagettiFisch <63868515+SpagettiFisch@users.noreply.github.com>
This commit is contained in:
parent
218eb2ea7e
commit
d86f8c360b
2 changed files with 3 additions and 3 deletions
4
main.py
4
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():
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue