Browser events extension BUG?

Using the browser events extension, i was creating a test program to shoot an arrow towards the cursor. in doing so, i added a system that sent the arrow farther the longer you held down the mouse button.

unfortunately, i found a bug. if you click while an arrow is already in flight, it keeps “is mouse 1 pressed” to true, meaning that the variable that controls the arrows flight power is constantly increasing.

here is a link to the program: https://arcade.makecode.com/S44955-90244-84676-50848

It looks like you’ve encountered an interesting issue! The bug you’re describing might be related to how the “is mouse 1 pressed” condition is being handled while the arrow is in flight. To resolve this, you could consider adding a check to make sure that the arrow is not already in motion before accepting new inputs. I’d recommend adding a variable to track whether the arrow is in flight, and only updating the power if the arrow is not already flying. Hope this helps!

2 Likes

@SouperMediocre1 this is happening because you are pausing in the button handler; try wrapping all the code in the “on button pressed” event inside a “separately do” block from the timers extension

1 Like

i’ve opened a pr to make it so that these buttons behave more like the controller buttons. should prevent this from happening: https://github.com/microsoft/pxt-common-packages/pull/1515

4 Likes

ok, I’ll try that and I’ll check out the pr, thanks.

I tried doing this, didn’t work so I removed the code.