obiot/melonJS — Issue #31: Key events for mobile devices
Author: Tolke
Created: 2011-12-21 18:32:00+00:00
State: open

Hello Olivier, thank you very much for your library, it is awsome.

Right now i am doing a game with your library, and it is intended for mobile devices, just a demo, to show that with your library can do.

Well the thing is, to simplify things, for moovement i add some arrows, and each one fires an "click" event, and inside each, i create a new event, and trigger it. The problem is that my player does not move. The event is triggered, so i think that you are using other attribute that jQuery does not write. jQuery write a normalize event, but i can add you atrributes from the "Original Event".

The question, which attribute did you watch to detect a key event?

Thanks in advance.

P.D.
The code i am using to trigger the event

$('#arrow').click(function() {
var e = jQuery.Event('keydown', {
which : 88,
keyCode : 88,
charCode : 0
});
$(document).trigger(e);
console.info('e: ', e);
});