diff --git a/src/battle-scene.ts b/src/battle-scene.ts index d880e3ff2..2d63f2165 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -128,6 +128,7 @@ export default class BattleScene extends SceneBase { public moveAnimations: boolean = true; public hpBarSpeed: integer = 0; public fusionPaletteSwaps: boolean = true; + public gamepadSupport: boolean = true; public enableTouchControls: boolean = false; public enableVibration: boolean = false; @@ -1299,7 +1300,7 @@ export default class BattleScene extends SceneBase { * again. */ gamepadButtonJustDown(button: Phaser.Input.Gamepad.Button) : boolean { - if (!button) + if (!button || !this.gamepadSupport) return false; let ret = false; diff --git a/src/system/settings.ts b/src/system/settings.ts index 09d5dde94..940392a8b 100644 --- a/src/system/settings.ts +++ b/src/system/settings.ts @@ -19,6 +19,7 @@ export enum Setting { HP_Bar_Speed = "HP_BAR_SPEED", Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS", Player_Gender = "PLAYER_GENDER", + Gamepad_Support = "GAMEPAD_SUPPORT", Touch_Controls = "TOUCH_CONTROLS", Vibration = "VIBRATION" } @@ -47,6 +48,7 @@ export const settingOptions: SettingOptions = { [Setting.HP_Bar_Speed]: [ 'Normal', 'Fast', 'Faster', 'Instant' ], [Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ], [Setting.Player_Gender]: [ 'Boy', 'Girl' ], + [Setting.Gamepad_Support]: [ 'Auto', 'Disabled' ], [Setting.Touch_Controls]: [ 'Auto', 'Disabled' ], [Setting.Vibration]: [ 'Auto', 'Disabled' ] }; @@ -130,6 +132,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer) } else return false; break; + case Setting.Gamepad_Support: + scene.gamepadSupport = settingOptions[setting][value] !== 'Disabled'; + break; case Setting.Touch_Controls: scene.enableTouchControls = settingOptions[setting][value] !== 'Disabled' && hasTouchscreen(); const touchControls = document.getElementById('touchControls');