Reputation: 3
I tried to put down a shape of Tetris with setInterval, and I had a function implemented that with keydown pressed, if it can, the shape will bi down 1 block, but I want do that every second... So, how can I trigger a keydown event in code to reuse my function?
Thanks and sorry for my english!
Arkaitz
Upvotes: 0
Views: 71
Reputation: 946
Some thing like this should work.
var newEvent = $.Event('keydown', {
keyCode: event.keyCode
});
newEvent.keyCode = $.ui.keyCode.DOWN;
$(this).trigger(newEvent);
Upvotes: 1