Tilting with keyboard is weird

When I try to tilt with a keyboard on my macbook air with Hopscotch 3.36.6, it gets stuck and rotates even after I stop pushing the key. This does not happen in Chrome. Messing with turning on and off the touch alternatives seems to fix it so it may not be a problem with Hopscotch, but it is really annoying. I don;'t know if it affects ipads with bluetooth keyboards.

Here’s a project which shows the tilt variables

I stop touching the key almost as soon as I push it, most of this I am not touching anything.


Huh weird also first post


It seems working for me but I’m on a phone so idk


I’m not sure how exactly the mechanism works, but arrow keys do tilt the device in touch alternatives.


Works fine on ipad with (wired) keyboard. Both using arrows and actually tilting device work


I think it has to do with touch alternatives, because


What’s that?


Look it up – it’s an accommodation in MacOS to substitute for touch functions like touch screen and tilt for iOS apps running on Mac.


Ohh, iv heard of that! For m1 macs right?

1 Like

Yes, that’s correct.


I’m fairly certain this is not a problem with Hopscotch, it seems like the ‘keyup’ event is acting weirdly. When I add this code to the player: window.addEventListener('keyup',function(e){ main.context.projectObjects.HSObject[0]._stageObjects[0].setText('keyup!' + Math.random().toString()) }) it changes the text repeatedly while I hold the key. When I run that in the javascript console in chrome it works like you’d expect and only changes the text when I let go of the key. When I add window.addEventListener('keydown',function(e){ main.context.projectObjects.HSObject[0]._stageObjects[0].setText('keydown!' + Math.random().toString()) }) it still changes repeatedly while I hold the key, but I don’t ever see keyup, so it seems like it doesn’t ever realize the key is released. I also tested having set text blocks set text to JSON.stringify(PIXI.keyboardManager.downKeys) and the key doesn’t get removed. I can’t really figure out how to get it to work correctly to see what happens then, and I updated my computer today so I’m not sure I can even still do it.

From what I can tell arrow keys swipe from the center of the screen. Tilt is wasd, but it’s not the way Hopscotch does it, it’s basically what you suggested where it sets tilt right to 50 for example.


I believe that’s just between browsers acting differently – in which case Safari would fire a keyup event upon repeated key inputs. It could be the source of the bug though, but I’m not sure. Try running the code in Safari’s console.

If this isn’t changing, and it’s only in the M1 app, then what’s most likely happening is that there’s no final key up being fired because the app registers a swipe and cancels the default event.

To test that theory, just make the object set text to Date.now() on key down and key up in two different objects and see if key up is always after key down.


No, safari acts the way you’d expect.

When touch alternatives is on it doesn’t even do keydown, I’m talking about when they are off. I only really have them on when playing platformers with buttons on oopposite sides of the screens.

Key up is always either the same value or 1 less than keydown.

It doesn’t seem like there’s a way for tht to actually fix this themselves.


Then that could be the issue. Keyup should always be equal to or greater.

Probably not with the current tilt implementation.


Oh I just thought that for example tilt right is a variable the increases when you tilt right and on computer if you press right arrow you increase the variable and even when you let go it still counts as you still tilting right and you would have to balance it out with the other tilt variables.