简体   繁体   English

如何使用蓝牙键盘在 iPad 和 iPhone 上播放 javascript 游戏?

[英]How can I do to make a javascript game playable on iPad and iPhone with Bluetooth keyboard?

I'm making a js html5 game where a player shoots enemies.我正在制作一个玩家射击敌人的 js html5 游戏。 The player needs to move up and down and shoot.玩家需要上下移动和射击。 Originally, I had up and down arrow keys used for moving and space bar for shooting.最初,我有上下箭头键用于移动和空格键用于射击。 On iOS browsers, the space bar works, but the arrow keys don't.在 iOS 浏览器上,空格键有效,但箭头键无效。 I replaced the arrow keys with w and s.我用 w 和 s 替换了箭头键。 That doesn't work on iOS either.这也不适用于 iOS。 What can I do to solve the issue and be able to play a js game on an iOS device with a Bluetooth keyboard?我该怎么做才能解决这个问题,并能够在带有蓝牙键盘的 iOS 设备上玩 js 游戏?

If you have an iPad o iPhone or any mobile device for that matter, your games should use touch screen features to navigate instead of keyboard press.如果您有 iPad 或 iPhone 或任何与此相关的移动设备,您的游戏应使用触摸屏功能进行导航,而不是按键盘。

you can have a icon on the corner of the screen that when the player touches it shoots.你可以在屏幕的角落有一个图标,当玩家触摸它时会射击。

as to the movement, if the player presses to the left, right, above, or below the character, that info should be used to navigate your character.至于移动,如果玩家向角色的左侧、右侧、上方或下方按下,则应使用该信息来导航您的角色。

using an attachable keyboard, will not only make the game more cumbersome, and on devices without a keyboard, your game will be unplayable.使用可连接的键盘,不仅会使游戏变得更笨重,而且在没有键盘的设备上,您的游戏将无法玩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM