Skip to content

Commit

Permalink
fix: multiple sprites in when_touching doesn't work (#42)
Browse files Browse the repository at this point in the history
* fix: multiple sprites in when_touching doesn't work

* chore: run black
  • Loading branch information
koen1711 authored Dec 7, 2024
1 parent 2f9a743 commit 6c634ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions play/objects/sprite.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,20 +422,20 @@ def decorator(func):
async_callback = _make_async(func)

async def wrapper():
wrapper.is_running = True
await run_async_callback(
async_callback,
[],
[],
)
wrapper.is_running = False

wrapper.is_running = False

for sprite in sprites:

async def wrapper_func():
await wrapper()

sprite._dependent_sprites.append(self)
callback_manager.add_callback(
CallbackType.WHEN_TOUCHING, (wrapper, sprite), id(self)
CallbackType.WHEN_TOUCHING, (wrapper_func, sprite), id(self)
)
return wrapper

Expand Down

0 comments on commit 6c634ba

Please sign in to comment.