Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug:offscreen({pause: true}) gets stuck once paused, must be unpaused manually #536

Closed
dragoncoder047 opened this issue Nov 24, 2024 · 0 comments · Fixed by #537
Closed
Labels
bug Something isn't working

Comments

@dragoncoder047
Copy link
Contributor

kaplay();

loadBean();

const bean = add([
    sprite("bean"),
    pos(),
    offscreen({pause: true}),
    rotate(),
    anchor("center"),
    {
        update() {
            this.angle += 400 * dt();
        }
    }
]);

camPos(0, 0);
wait(1, () => {
    camPos(1000, 1000);
    wait(1, () => {
        camPos(0, 0);
    });
});

onUpdate(() => {
    debug.log(bean.isOffScreen());
});

So, the bean is not paused when it is spinning, but as soon as it goes offscreen it pauses cause of the offscreen() comp, but when it comes back on screen again, isOffScreen() returns the right value but bean does not spin cause it is paused. culprit I think is that the offscreen comp uses its own component update() to listen for coming back onscreen which just isn't called when the obj is paused! It should use a global onUpdate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant