littensy / slither

🐍 A casual game with a soothing Catppuccin color palette
https://www.roblox.com/games/14162747150
MIT License
119 stars 9 forks source link

Snake control is interrupted while hovering over other GUI elements #149

Closed Dionysusnu closed 1 year ago

Dionysusnu commented 1 year ago

When the mouse cursor is on top of other GUI elements (so far confirmed: Chat window; Popup notifications), the snake will no longer react to the mouse, and instead go straight in its current direction.

Dionysusnu commented 1 year ago

I think the fix might be setting a high ZIndex on InputCapture? https://github.com/littensy/slither/blob/de627db1d63cfcbad476c1542d0e37c788b9b54b/src/client/app/common/input-capture.tsx#L14

NeoInversion commented 1 year ago

Will require getting the mouse position some other way (useMouse from React hooks). To keep Hoarcekat working check if running in studio.

littensy commented 1 year ago

I think the fix might be setting a high ZIndex on InputCapture?

https://github.com/littensy/slither/blob/de627db1d63cfcbad476c1542d0e37c788b9b54b/src/client/app/common/input-capture.tsx#L14

I decided to have InputCapture use UserInputService instead of a Frame if it's being used in a running game. The original purpose of the component was to listen to user input events from the Hoarcekat plugin window, so it should be fine.