Is there a way or tips to make this mouse cursor controllable with keyboard arrows when a switch is turned on?
Thanks in advance!
Viewing post in R-Stick Mouse MV + MZ comments
I don’t have specific support for that right now, but you can edit new_pollGamepads to add this feature:
Directly above dx = dx * speed;, add the following:
// Edit: Keyboard arrow controls
if ($gameSwitches && $gameSwitches.value(12345)) { // Replace with your Switch ID.
if (Input.isPressed('left')) dx -= 1;
if (Input.isPressed('right')) dx += 1;
if (Input.isPressed('up')) dy -= 1;
if (Input.isPressed('down')) dy += 1;
}
// End of edit.
This is untested, but I’m confident it’ll work.
(Flipping a sign here or there may be necessary.)
Note that this will use the main directional input to move the cursor, which means the L-stick and D-pad should also work. If you’d like the input to be distinct, I recommend (dynamically, if there’s a collision) binding a custom intent in Input.keyMapper and checking for that in the snippet above instead.
After modifying your edit a bit. It achieves what I want. Your original edit has the error of null value (somehow). I'll just share my edit.
if (Input.isPressed('left') && $gameSwitches.value(n)) dx -= 1;
if (Input.isPressed('right') && $gameSwitches.value(n)) dx += 1;
if (Input.isPressed('up') && $gameSwitches.value(n)) dy -= 1;
if (Input.isPressed('down')&& $gameSwitches.value(n)) dy += 1;
Not exactly a pretty code, but it works. Thanks for your help.