🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Handle Arrow keys inside iframe

A topic by Wild Spike created 29 days ago Views: 51 Replies: 2
Viewing posts 1 to 3
(+4)

Hello,

Recently I add html5 game with keyboard and mouse support. It works fine as standalone html5 application. But arrow keys doesn't forwarded into game on this site.

Problem - https://wildspike.itch.io/way-of-tanks

Works fine - http://apps.ugolnik.info/wayoftanks/

Is it possible to fix on yours or my side?

Admin (Edited 1 time)

What game engine are you using? Some engines bind to event handlers in a way that isn't friendly with iframes. Here's a discussion about the problem with someone using pixi.js: https://github.com/itchio/itch.io/issues/727#issuecomment-337490481

Hello,

Thank you for reply. I use my own game engine. Here is workaround:

postRun: (function() {
                window.addEventListener('mousedown', function(evt) {
                    window.focus();
                    evt.preventDefault();
                    evt.stopPropagation();
                    evt.target.style.cursor = 'default';
                }, false);
            })(),