Created
February 21, 2023 05:45
-
-
Save arpruss/bc69fae73ec906423a0d59c85ad76a7f to your computer and use it in GitHub Desktop.
wiimote freepie script for Internet Arcade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wiiTranslate = { WiimoteButtons.DPadDown: Key.DownArrow, | |
| WiimoteButtons.DPadUp: Key.UpArrow, | |
| WiimoteButtons.DPadLeft: Key.LeftArrow, | |
| WiimoteButtons.DPadRight: Key.RightArrow, | |
| WiimoteButtons.B: Key.LeftControl, | |
| WiimoteButtons.A: Key.LeftAlt | |
| } | |
| nunchuckTranslate = { NunchuckButtons.C: Key.LeftAlt, NunchuckButtons.Z: Key.LeftControl } | |
| def translate(buttonDown,map): | |
| for k in map: | |
| if buttonDown(k): | |
| keyboard.setKeyDown(map[k]) | |
| else: | |
| keyboard.setKeyUp(map[k]) | |
| def stick(threshold,stick,up,down,left,right): | |
| def axis(x, left, right): | |
| if x <= -threshold: | |
| keyboard.setKeyDown(left) | |
| else: | |
| keyboard.setKeyUp(left) | |
| if x >= threshold: | |
| keyboard.setKeyDown(right) | |
| else: | |
| keyboard.setKeyUp(right) | |
| axis(stick.x,left,right) | |
| axis(stick.y,down,up) | |
| for i in range(2): | |
| if wiimote[i].balanceBoard.weight: | |
| diagnostics.watch(wiimote[i].balanceBoard.centerOfGravity) | |
| stick(15,wiimote[i].balanceBoard.centerOfGravity, Key.UpArrow, Key.DownArrow, Key.LeftArrow, Key.RightArrow) | |
| else: | |
| translate(wiimote[i].buttons.button_down, wiiTranslate) | |
| translate(wiimote[i].nunchuck.buttons.button_down, nunchuckTranslate) | |
| stick(35,wiimote[i].nunchuck.stick, Key.UpArrow, Key.DownArrow, Key.LeftArrow, Key.RightArrow) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment