简体   繁体   中英

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. 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. I replaced the arrow keys with w and s. That doesn't work on iOS either. What can I do to solve the issue and be able to play a js game on an iOS device with a Bluetooth keyboard?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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