Closed Faeest closed 1 month ago
I don't understand what you mean. Can you make a demo of the issue?
Here's my Input
class, which includes a movement
method for keyboard controls based on configurable key settings. The output changes with each frame. Right now, the controller part of the code isn't implemented, as you can see from the empty if
statement. For the time being, the class only handles keyboard events, but it seems that controller inputs are incorrectly getting through as arrow key inputs, which needs fixing.
class Input {
constructor() {
this.settings = {
key: [
["a", "d", "w", "s"], // WASD keys
["arrowLeft", "arrowRight", "arrowUp", "arrowDown"], // Arrow keys
],
controller: [],
};
}
movement(options = { controller: false, id: 0 }) {
let action = createVector();
if (options.controller) {
// Spot for future controller code
} else {
if (this.settings.key[options.id]) {
if (keyboard.pressing(this.settings.key[options.id][0])) {
action.x -= 1;
}
if (keyboard.pressing(this.settings.key[options.id][1])) {
action.x += 1;
}
if (keyboard.pressing(this.settings.key[options.id][2])) {
action.y -= 1;
}
if (keyboard.pressing(this.settings.key[options.id][3])) {
action.y += 1;
}
}
}
return action;
}
}
What kind of controller are you using?
Do you have any controller remapping software running on your computer?
Software like Rewasd maps controller input to keyboard inputs to help users play games like Valorant with a controller. You'd need to disable it when using p5play.
I can assure you that this couldn't possibly be an issue with p5play itself because the browser's keyboard and controller APIs, which p5play uses, are totally separate.
If you find the cause of the issue let me know. Otherwise you can write your game code in such a way that it disallows keyboard inputs while a controller is connected.
yes, it's the steam. After all of the time I spent, it's the steam 😄
I want to make a 4 players couch game but the controller input is ALWAYS getting mixed with the keyboard arrow input, how to fix this?