Open
Description
I've been trying to update that function so that if I set up new buttons, all those buttons don't appear in the other games.
Maybe as a simple sketch it could be useful for you to be able to detect this in a different way so that each game loads its buttons.
function updateTouchControlsVisibility() {
if (hasTouchscreen && Object.keys(gamepads).length === 0) {
for (const elem of document.querySelectorAll('#dpad, #apad')) {
elem.style.display = '';
}
const urlParams = new URLSearchParams(window.location.search);
const gameParam = urlParams.get('game');
if (gameParam !== 'powerchars') {
const oneButton = document.querySelector('[data-key="One"]');
if (oneButton) {
oneButton.style.display = 'none';
}
}
} else {
for (const elem of document.querySelectorAll('#dpad, #apad')) {
// Ocultar los controles táctiles
elem.style.display = 'none';
}
}
}
Try in from a touch device or from the browser emulator, try the following links to see different buttons for each game:
Link1: https://netherwareentertainment.com/online/?game=powerchars
Link2: https://netherwareentertainment.com/online/?game=ian-precuela
Download index.html edited: index.zip